What is the ruling on writing the name on a grave to identify its occupant?
The answer is that it is not permissible, for two reasons.
As for the first reason, the Prophet Muhammad ﷺ forbade writing on graves.
This is general; nothing is excluded from it.
As for the second reason, it is what the brother mentioned.
Namely, one may need to know say, his father's grave or his mother's.
For visitation, greeting, and supplication.
This need existed in the time of the Prophet Muhammad ﷺ.
The need was there, and writing was possible, yet it was not done.
The grave used to be identified by a pebble or the like.
So such writing is not prescribed.
because the need for this existed in the Prophet ﷺ's time, and was feasible.
Yet the Prophet ﷺ did not do it.
That shows it is not prescribed and is not permissible.
A person should mark his loved one's grave with a clear marker.
by its location, and by the number of graves.
and by placing a pebble or something similar.
That is sufficient. Allah ﷻ knows best.