First of all, it depends on whether there is a repayment period in the loan note when your friend owes money. Secondly, it depends on whether there is an agreement between the two parties when the patent is pledged to you, and how to deal with it if the patent is not returned. Of course, it depends on whether he owns the patent himself, and whether the value of the patent is equal to the money he owes you.
If he doesn't pay back the money at maturity, the patent belongs to him, and the value is not lower than the debt. He is willing to give up the patent, and you can transfer it to a third party to obtain benefits and make up for your loan loss.