When Allah swt forgives and replaces Evils by Good, Dr Emdad Khan:
Some time we do sins or evils and then regret.
If we sincerely repent, and then move forward, it may be replaced by good.
Allah swt gives the good news in Surah Al Furqan Ayah 70.
Al Furqan A70
إِلَّا مَن تَابَ وَءَامَنَ وَعَمِلَ عَمَلًۭا صَـٰلِحًۭا فَأُو۟لَـٰٓئِكَ يُبَدِّلُ ٱللَّهُ سَيِّـَٔاتِهِمْ حَسَنَـٰتٍۢ ۗ وَكَانَ ٱللَّهُ غَفُورًۭا رَّحِيمًۭا ٧٠
As for those who repent, believe, and do good deeds,
they are the ones whose evil deeds Allah will change into good deeds.
For Allah is All-Forgiving, Most Merciful.
— Dr. Mustafa Khattab, the Clear Quran
Here Allah swt gives us opportunity after committing sin to do repent sincerely.
And continue do good deeds.
Here Allah swt assures us He by His mercy will replace the evil deeds with good.
If we regret and repent your past sins mistakes and shortcoming.
We should move forward. Not be over fixed on that sin or mistakes.
InshaAllah, Allah swt will forgive and may also replace the evil deed by good deed.