It is not permissible to write on a grave.
A hadith of the Prophet ﷺ states:
نهي النبى صلى الله عليه وسلم و أن يكتب عليه
“The Prophet ﷺ forbade writing on a grave.”
Reference: Sahih (authentic): Sahih Abi Dawud: 2763, Kitab al-Janaiz: Bab fi al-Bina’ ala al-Qabr, Abu Dawud: 3226, Tirmidhi: 1052