وَوَلَدًا صَالِحًا تَرَكَهُ mentions the blessing of raising a righteous child. Parenting involves more than providing material comfort; affection, moral example, and proper upbringing matter. Raising a child does not guarantee a particular outcome; each person remains responsible for their own conduct.
أَوْ مُصْحَفًا وَرَّثَهُ describes passing on a copy of the Qur’an so that others may recite and learn from it.
In وَلَدًا صَالِحًا, صَالِحًا is an adjective describing وَلَدًا. وَرَّثَهُ means “he left it as an inheritance or passed it on.”