As purchasing flat in cash is lawful, in the same way purchasing flat on loan is lawful and valid. But you cannot charge extra payment after maturity of the debt period except what was mutually agreed upon. Charging extra amount will be considered as interest.
Allah knows Best!
Darul Uloom Deoband