The contract is invalid for two reasons.
the land is mortgaged to the bank through the loan.
In fact, the mortgagee's consent is a prerequisite for selling a mortgage.
the debtor alone is liable to pay the debt. Thus, debt liability may not be transferred to someone else unless in the case of the transfer of a debt which is not applicable here. And Allah knows best. May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.