Delegates from twelve of the original thirteen states met to discuss and write the Constitution. The man credited with most of the writing was James Madison. He is, in fact, considered to be the "father of the Constitution."
However, all of the delegates contributed to writing the Constitution. The men met to discuss the rights which they thought should be granted to every United States citizen. In addition, it was determined that any changes to the Constitution would require the approval of at least nine of the thirteen states.
The Constitution was written in order to grant more power to the larger states. In addition, Madison included branches of the government which would have power over very specific issues and jurisdictions, which included a system of checks and balances so that no person or entity in the Government would have too much power.
Constitution laws has more information on the writing of the Constitution.