CPF is meant for your retirement needs. When you use your CPF savings for your property, your retirement savings are reduced. Hence, when you sell your property, you'll need to refund the amount that you have used plus the interest accrued on this amount. This is to restore your retirement savings. If you have pledged the property to make up your retirement sum, you will also need to refund the pledged amount.
Do note that your HPS cover will also end when your HDB flat is sold. The unused portion of your premium will be refunded into your OA.