The repentance accepted by Allah is only for those who do wrong in ignorance [or carelessness] and then repent soon after. It is those to whom Allah will turn in forgiveness, and Allah is ever Knowing and Wise.
But repentance is not [accepted] of those who [continue to] do evil deeds up until, when death comes to one of them, he says, “Indeed, I have repented now,” or of those who die while they are disbelievers. For them We have prepared a painful punishment.
The followig excerpt is taken from “Maariful Quran” vol 2 pg. 363-368:
Shafi, Muhammad (2008). Maariful Quran. (Vol .2 pg. 363-368). http://www.islamicweblibrary.com/wp-content/uploads/2020/04/maarif-volum2-english.pdf