These verses related to Prophet Yousuf’s ordeal mentioned in the Quran, when his ordeal was over and he declares (as Allah tells us in this verse) that Allah does not waste the reward of good doers.

Allah says in the Quran:

They said: “Are you indeed Yoosuf (Joseph)?” He said: “I am Yoosuf (Joseph), and this is my brother (Benjamin). Allah has indeed been gracious to us. Verily, he who fears Allah with obedience to Him (by abstaining from sins and evil deeds, and by performing righteous good deeds), and is patient, then surely, Allah makes not the reward of the Muhsinoon (good-doers)to be lost.”
Quran (Surah Yousuf, Verse 90)
“Muhsin” is an Arabic word that means “good-doer”. He is one who performs good deeds totally for Allâh’s sake only without any show off or to gain praise or fame, etc., and in accordance with the Sunnah of Allâh’s Messenger Muhammad. (Muhsin Khan Quran Interpretation.)

— End
Read more:
This is helpful. JazzakumAllah khaiyran