According to Hindu mythology, Sage Ved Vyasa composed the Mahabharata epic but needed a scribe to write it down as he recited. Lord Ganesha agreed to be the scribe on the condition that Vyasa would recite continuously without pause. Valmiki wrote the Ramayana, and Kartikeya is a different deity altogether.