IFAIK the loans are secured by Twitter equity. Trouble is the loans add up to more than what Twitter is worth. The banks will have to write down the value of those loans. But the equity investors, including Elon, will get what scraps, if any, are left after creditors get paid.
>>Zigurd+(OP)
Musk is still on the hook for the loans whether Twitter goes under or not. The danger they face is if Musk loses enough to not be able to cover the loans personally.