Imam Ali (AS) did write Hadeeths which he heard from the Prophet Muhammad (SAWA). His book is called Al-Jaami'ah الجامعة. or Kitab Ali.
'It remained after him with the Infallible Imams and now it is with Imam Al-Mahdi (AS).
Ahlul Bayt (AS) encouraged their students to write books in Hadeeth and other fields of knowledge. Four hundred main books were complied by the sydents of Imam Jafar Al-Sadiq (AS) but the enemies destroyed them. We have now Fiur Hadeeth books ( Al-Kaafi, Al-Tahtheen, Al-Istibsaar and Al-Faqeeh) which contain main narrations which are much more than the narrations in Bukhari and Muslim.
Wassalam.