All you have to do is pay off all the mortgages first. There are two modes of operation. First, the seller pays off himself and takes out the title certificate to transfer the ownership. Generally, the seller pays off the loan by self-financing, and some buyers pay part of the cash to the seller in the form of down payment to help them get back the real estate license, but this way is too risky for the buyer and generally will not do so. This is for houses that have been mortgaged in the bank for the time being. If the house doesn't even have a real estate license, obviously it can't be done.
Second, the buyer pays the mortgage for the seller, but the buyer also faces risks. Notarization is essential. The notarization content is that the seller transfers the mortgaged house to the buyer, and the buyer pays the mortgage for the seller. After paying off, the buyer and the seller will go through the transfer formalities again. And agreed that if the seller does not cooperate, the housing transaction procedures should be done. Especially for the buyer, there may be cases where the seller refuses or delays the transfer formalities after paying the down payment, and the transfer cannot be carried out smoothly.
To sum up, it is not recommended to buy.