No one knows actually who invented or started writing, but according to history experts, writing is thought to have been invented in Mesopotamia (now known as Iraq) about 6,000 years ago, in 4000 B.C. There are some issues that writing had occurred 2,000 years earlier, from the tortoise-shell carvings excavated in China, although it is still debatable if the markings are complex enough to qualify as written language.
So, Mesopotamian cuneiform is still the first widely acknowledged form of writing. Writing then was a closely guarded skill used mainly by scribes and priests. Its original function was in accounting, for example, counting how many slaves were working on a particular job. The founding of written words was closely accompanied by the first numbers.
After the practice started in Mesopotamia, writing started to show up in different places worldwide such as Egypt and India. The first alphabet in the world is thought to have originated in Egypt in 2000 BC, which later spread to the rest of the world.