Which is the correct way to construct sentence to tell past routine?
He slept most of time whenever I visited him.
He would sleep most of the time when I visited him
Both sentences have give the same, or similar meanings. Using "would" to describe past routine is quite formal, and can be ambiguous with the use of "would" to form conditional expressions.
There is also "used to"
He used to sleep for most of the time whenever I visited him.
Both are technically sound, but since it is shorter I would choose: He slept most of the time whenever I visited him.
Neither are particularly great. I would it as: “He would sleep most of the time during my visits.”
Both are fine.
We can also say, He used to sleep most of the time when I visited him. (We can put 'used to' in place of 'would'. We use 'used to' to talk about past habits.)