When you try to figure out the purpose of government, you can easily get bogged down in all of the many things a government does or should do — from defending the people to managing the federal budget. And if you ask a dozen people what the purpose of government is, you'd probably get a dozen different answers, depending on individual point of view.
What is the purpose of government, and how does a bill become law?
That's because everyone — and I mean everyone — has a different view of what a government should and shouldn't do. Some think the government should control everything, while others think government should have a limited role in people's lives. Some think that the government should be run by one person, as in a dictatorship, while others think the people should have the right to elect their representatives and leaders, as in a democracy. In fact, the purpose of government has been at the root of philosophical and political debates for many hundreds of years. Just think of any presidential debate you've seen: If you boil down what the candidates say, you basically end up with their views on the purpose of government. And, of course, their views usually differ quite a bit!
So, the answer to the first part of your question is really a non-answer: The purpose of government is whatever you think it should be. Just think of your own government, and consider what you think the government should and shouldn't do. Odds are, what you think the government should do is your own personal view of the purpose of government.
The second part of your question is much easier to answer. Basically, a bill — after much haggling — must first be passed by the congressional house (either the Senate or House of Representatives) in which it was introduced. Then it goes to the other congressional house, where — again, after much haggling — it must be passed. Often, at this point, there are two versions of the same bill, and these two versions must go into committee, where there's a whole lot more haggling to come up with a single, unified version.
After the two congressional houses finally agree upon the unified version, the bill goes to the President, who will either sign the bill into law or veto the bill (which means the bill doesn't become law). If the President takes no action for ten days, while Congress is in session, the bill automatically becomes law. If the President does the same thing while Congress is out of session, the bill dies and does not become law (also called a pocket veto). The Congress can overturn a Presidential veto with a two-thirds vote in favor of the bill.