You take the loan (and probably some other money, since by definition the loan is less than the total value of the company's assets), and you go buy the company. You now own the company, therefore you own the assets, therefore you can use them as collateral, and so: the debt that was yours is now on the company's books. You bought out the company with extra leverage provided by the assets you were acquiring: leveraged buyout.
It tends to fail; LBOs tend to target companies that are struggling somehow, and loading an already-struggling company with a shit load of debt frequently results in a bankruptcy. You're probably familiar with companies that dies this way. (My favorite example for fellow millennials is Toys'R'Us.) If you find this troubling: you are correct. But you have forgotten the really important thing: you (or, in most LBOs, a bunch of private equity ghouls) have gotten very wealthy killing a company, and isn't that reward enough?