All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
You stated that you had a miscarriage at almost four months. It is prescribed to wash and shroud the miscarried fetus, offer the funeral prayer over it, and bury it. Kashshaf Al-Qina’ reads: “A miscarried fetus after four months or more may be washed, shrouded, prayed over (funeral prayer), and buried. This was mentioned in the report of Harb and Salih because the Prophet said: ‘Funeral prayer should be performed over a miscarried fetus and forgiveness and mercy are supplicated for its parents.’ [Ahmad and Abu Dawood, An-Nasa’i] [Al-Tirmithi: authentic] This wording was recorded by An-Nasa’i and At-Tirmithi.”
There is no problem with visiting graveyards, and it is also permissible to place something on the graves to be recognizable. Scholars stated that it is recommended to raise the grave above the ground to be known, respected, and visited. Mughni Al-Muhtaj reads: “It is recommended to raise the grave a span above the ground to be known so that it would be visited and respected.”
The Hanbali scholars Al-Bahooti said in Kashshaf Al-Qina’: “It is recommended to raise the grave one span above the level of the earth to be recognized and avoided.”
Allah knows best.