The fourth Hadith of the An nawawi collection explains that the final actions are the true meaning of deeds.
On the authority of Abdullah ibn Masud (may Allah be pleased with him), who said: The Messenger of Allah (peace be upon him), and he is the truthful and the believed, narrated to us:
”Verily the creation of each one of you is brought together in his mother’s womb for forty days in the form of a drop, then he becomes a clot of blood for a like period, then a morsel of flesh for a like period, then there is sent to him the angel who blows the breath of life into him and who is commanded with four matters: to write down his sustenance, his life span, his actions, and whether he will be happy or unhappy (whether or not he will enter Paradise).
By Allah, other than Whom there is no deity, verily one of you performs the actions of the people of Paradise until there is but an arm’s length between him and it, and that which has been written overtakes him, and so he acts with the actions of the people of the Hellfire and thus enters it; and verily one of you performs the actions of the people of the Hellfire, until there is but an arm’s length between him and it, and that which has been written overtakes him and so he acts with the actions of the people of Paradise and thus he enters it.” [Bukhari and Muslim]
One main lesson from this Hadith is it introduces the concept of fear and hope. Let fear overcome you in the matters of your good deeds as, by Allah’s decree, one bad deed that follows may negate them.
Conversely, let hope overcome you in the matters of your bad deeds as, by Allah’s decree, one good deed that follows may purify you from their harm.
And Allah knows best.