You're correct. The government technically can never run out of money because it runs on the fiat standard
Fiat currency is legal tender whose value is backed by the government that issued it. The U.S. dollar is fiat money, as are the euro and many other major world currencies.
This approach differs from money whose value is underpinned by some physical good such as gold or silver, called commodity money. The United States, for example, used a gold standard for most of the late 19th and early 20th century. A person could exchange U.S. currency -- as well as many public and even some private debts -- for gold as late as 1971.
A fiat currency's value is underpinned by the strength of the government that issues it, not its worth in gold or silver.
Now, the government doesn't actually physically print money to do this (we call it printing because it's easier to understand that way). Instead, it simply does some ledger things that would get any other person arrested. Specifically, The Federal Reserve buys Treasury Bonds without expending money to do so, a process called Quantitative Easing
Quantitative easing is a massive expansion of the open market operations of a central bank. It’s used to stimulate the economy by making it easier for businesses to borrow money. The bank buys securities from its member banks to add liquidity to capital markets. This has the same effect as increasing the money supply. In return, it the central bank issues credit to the banks' reserves to buy the securities.
Where do central banks get the credit to purchase these assets? They simply create it out of thin air. Only central banks have this unique power. This is what people are referring to when they talk about the Federal Reserve “printing money.”
The US recently did this under Obama, and the US printed somewhere around $2 trillion dollars
[The Federal Reserve] added almost $2 trillion to the money supply. That’s the largest expansion from any economic stimulus program in history. As a result, the debt on the Fed’s balance sheet doubled from $2.106 trillion in November 2008 to $4.486 trillion in October 2014.
This isn't to say this is a good idea, mind you. Raising the volume of money on the market causes the value of it to fall. Do it too much, and you risk something called hyperinflation, where the value of the currency enters a free-fall, such as what happened to Germany in World War I
To pay for the large costs of the ongoing First World War, Germany suspended the gold standard (the convertibility of its currency to gold) when the war broke out. Unlike the French Third Republic, which imposed its first income tax to pay for the war, German Emperor Wilhelm II and the German parliament decided unanimously to fund the war entirely by borrowing, a decision criticized by financial experts such as Hjalmar Schacht as a dangerous risk for currency devaluation.
The strategy backfired when Germany lost the war. The new Weimar Republic was now saddled with a massive war debt that it could not afford. That was made even worse by the fact that it was printing money without the economic resources to back it up. The Treaty of Versailles further accelerated the decline in the value of the mark so 48 paper marks were required to buy a US dollar by late 1919.