Written language was invented independently by the Egyptians, Sumerians, Chinese, and Mayans.
The first written language was the Sumerian cuneiform. Writing mainly consisted of records of numbers of sheep, goats and cattle and quantites of grain.
To the best of our knowledge, writing was invented independently at least three times: Sumerian cuneiform in Mesopotamia (ca. 3400 BCE), Chinese characters in China (ca. 1200 BCE) and Mayan glyphs in Mesoamerica (ca. 300 BCE). Of these, only the Chinese script is an unbroken living tradition.