Mohammed could definitely write near his death, there is a hadith written near his time of death where he asks for paper to write on. I'll try to find it.
Lol. That Shia-favoured Hadith I fondly remember hearing about. Muhammad was near approaching death and he wanted to write something very important for all the Sahaba to use as a written decree over something/someone special.
Umar ibn Khattab (the original Shariah enforcer) detested this, probably worried that what Muhammad would write would change the course of Islam's political history, and said something like the Prophet is talking jibberish (He used the term Hazyan/Hadhyan in Arabic) and said the Quran is enough for us.
Poor Muhammad didnt get the chance to write what he wanted to write.
I wonder if it was to really signify that Ali ibn Abi Talib would be the successor, (if the Hadith of Ghadir Khumm was not already enough.) Mann kuntu mawla fa'haza Ali'yun mawla.