1. I am assuming that you have a registered agreement for sale executed with the builder.
2. I fail to understand as to how without first cancelling the agreement with you, the builder sold the property to another purchaser and that purchaser too purchased the property. Generally a purchaser before buying any property from builder causes a search to be done from the office of the sub registrar to check whether the builder has created any prior rights for the property which this purchaser intends to purchaser.
3. Anyway I suggest you sign a formal deed of cancellation with the builder and get this deed registered.
4. Since no transfer of property happens through a cancellation deed, there is no stamp duty or there will be nominal stamp duty.
5. In this deed you mention how the builder has to make repayment of the moneys paid by you to him.
6. Also record in the deed that the original sale agreement will be handed to the builder only on the builder simultaneously repaying your entire money.
7. I dont understand why on earth you agreed for refund in installments. Anyway talk to the builder and tell him that since he has already received full consideration from new buyer, in all fairness, the builder should also repay you in one shot.
8. No need to go to court for trivial matters.