You have years to reinvest, but a nearer deadline to protect it
The reinvestment exemption gives you real time: you can buy a new house up to two years after the sale, or construct one within three years. So you are not expected to have reinvested by the time you file. What the law does require is that you do not simply hold the money loose in the meantime.
If, by the date your return is due, you have not yet reinvested the gain, you must park the unspent amount in a special Capital Gains Account Scheme account with a bank by that same due date (Section 54(2), and the same rule for 54F). Depositing it there preserves the exemption and buys you the full two or three years to actually buy or build. Fail to reinvest and fail to deposit in CGAS by the due date, and the exemption is lost, the gain becomes taxable in the year of sale.
The deadline that actually matters
The trap is treating the two or three year reinvestment window as the only deadline. It is not. The operative cut-off is the due date for filing your return: by then, whatever part of the gain you have not spent on the new house has to be in the CGAS account. For an NRI abroad who has not lined up a purchase in time, this is the single date to protect.
Some High Courts have read the deadline generously, allowing a deposit up to the later belated-return date rather than the original due date, and some tribunals have held that if the whole gain was genuinely invested before you actually filed, the exemption should not be denied just for skipping CGAS. These are helpful, but they are litigation positions, not settled rules the department will simply accept. The safe course, and the one a CA will advise, is to make the CGAS deposit by the normal due date and not rely on the concessions.
What happens to money left in the account
The CGAS account is a holding pen, not a permanent shelter. Whatever you deposit has to be used to buy or build the new house within the two or three year window. If some of it is still unused when that window closes, the unutilised amount is brought to tax as capital gain in the year the period expires, and you can then withdraw it under the scheme rules.
So the account preserves the exemption while you complete the purchase, but it does not remove the obligation to actually reinvest. A practising CA sets up the CGAS deposit by the due date, files the return claiming the exemption, tracks the reinvestment through the window, and, where part goes unused, computes the tax correctly in the right year rather than leaving it to surface as a demand.