Mesopotamia and Egypt were both among the earliest societies to develop writing. As well as being pioneers of literacy, they were among the earliest civilizations to engage in extensive irrigation projects, and they had complex urban civilizations, often spanning prime agricultural lands subject to frequent invasions. These circumstances meant that these civilizations needed complex bureaucratic structures to complete projects that required large scale coordination, whether architectural, agricultural, or military. Writing served to facilitate such coordination. It was especially useful in keeping track of taxes and land ownership.
We understand far more about cultures whose scripts we have deciphered than about either preliterate cultures or cultures whose scripts we have not deciphered. Writing gives us access to a cultures' self understanding. It also helps us learn the myths and rituals of a culture. Law codes, tax documents, and legal contracts help us understand the social, economic, and political structures of civilizations.
For additional questions, please post a separate Q&A.