Writing began as accounting.
One interpretation holds that writing and numbers arose in Mesopotamia when small clay tokens representing quantities of grain and sheep gave way to pressing their shapes into clay tablets. Sumerian temples and palaces rationed barley to workers, lent seed to farmers and recorded everything on clay.