

To also add to the other comments: because the government doesn’t want or even need to have a balanced “checkbook”.
Assume for example you want to buy something from me. But you only have “don bucks”. So you buy a widget from me and I charge you 10 “don bucks”.
Problem though, through taxes you’ve only got 5 bucks left. So you just create 5 bucks and add it to your pile. (Deficit spending) Now if you don’t balance that with a loan, your “don bucks” are now worth less because why would I want one of your “don bucks” when tomorrow you could just create a million of them for no reason. (Hyperinflation) So you instead borrow 5 bucks from a friend of yours with a promise to give him back 6 tomorrow. (Bonds)
I still sell you my widget for 10 “don bucks” but now what can I spend my newly acquired “don bucks” on? Well, since everyone has their own currency I ultimately have to spend it on you. This means I end up giving you those 10 bucks back in hopes that you’ll either give me more in return (another loan/bond) or give me back my own currency from money I’ve traded to you.
So in the end spending more than you make (at the nation state level) can be a net boon on the economy as you effectively create a vendor lock in, similar to how companies push their gift cards, etc … because that money is only good in one place. You just have to make sure not to spend too much beyond your means because every dollar you create this way adds to inflation a little bit. So if you create too much then inflation gets out of hand and you end up with hyperinflation and now every one of your citizens wants to get rid of your money because they’ll lose too much before they can give it back.
More technically there’s two ways to move data between two separate services. You can either pull or push the data.
Assume for both scenarios that the client is your phone and the server is some machine in the cloud.
With pulls the client calls an API and the server returns a response. Generally the www works this way. You ask a server for a wab page and you effectively pull the source down to your browser.
Pushes work the opposite, in that a server has data for the client and needs to push or otherwise give it to you. Pulls are relatively strait forward because every server has a well known name (the domain name and url). But your phone’s IP address changes constantly. So how does a server know how to contact your device? There’s generally two ways:
You could in theory implement either of these yourself but because of the way the OSes work on both Android and iOS there’s no guarantee that you can keep a process running in the background forever. As the OS can kill your process if the OS needs more free ram, etc … The built in notification APIs are exempt from this because they are part of the OS.