To understand the logic, simply think of this scenario. Say I owe you $100,000. I can't pay you that much money. But now imagine I have the ability to simply create money out of thin air. All I have to do is create that money and give it to you. Governments have the ability to create money out of thin air and give it to people. Therefore, it makes a certain amount of sense to try to print more money to get out of debt.
The problem is that this does not take inflation into account. As more and more money is printed, each dollar becomes worth less and less. Inflation ruins the value of the money and the country is still in debt.
So, the logic of printing money to get out of debt is straightforward, but it is also infeasible. That is why countries do not typically try to pursue such a policy.