What is the purpose of government?
There is no objective way to answer this question as different people will think that governments have different purposes. For example, monarchs of the Middle Ages would have thought the purpose of government was to keep their kingdoms stable and prosperous so as to ensure the strength and continuation of their royal dynasty. Karl Marx would have said the purpose of government in a capitalist society is to bolster the strength of the bourgeoisie and keep the proletariat down.
To most of us today, the purpose of government is more like what John Locke says it is. To Locke, government's purpose is to protect our basic human rights. In a state of nature, we would not be able to protect our rights unless we were strong. Therefore, we create governments to protect (as Locke said) our life, our liberty, and our property. The purpose of government is to protect those things while taking away as little as possible of our freedom to act as we wish.