How new money flow work in country?
Your example is faulty


You have 10 and spent it on Inputs (Let's assume just wages)
Now you have 0 and people have 50 (40 + 10 wages you paid them)
People buy your goods for 20. You have 20 and people have 30
You pay a tax of 5. You have 15, people have 30, govt has 55
Govt pays salaries (Only to its employees). You have 15, people have 50, Govt has 35


In this case, the govt ended up with less money than it started with. This is called a "Fiscal Deficit" when the govt spends more than it earns. A deficit can be funded in many ways
 - loan from international institutions
 - Monetary financing (Printing Money)

But a deficit is a choice the govt makes. It is by no means inevitable if the govt has budgetary discipline. It just needs to keep its expenses controlled w.r.t its income