Can the capital gain amount be used for clearing loans?

Yes, the amount can be used to clear loans but the Long Term Capital Gain tax cannot be saved in that case.