How to buy new house before disposing earlier one?

I own an apartment in Delhi. I want to shift to another part of the city. Recently my father-in-law has disposed of his house in Delhi. Is it possible that he buys an apartment in my or his daughters name out of his funds and I move to that house, then I can dispose of my house and buy him back a new house. Is it correct to carry out such transactions from the capital gain and or other tax related issues prevalent in India?