‘Ibn ‘Ata’illah said:
“When you commit a sin, let it not be a reason for your despairing of attaining to righteousness before your Lord, for that might be the last sin decreed for you.” 
Reflection: This quote from Ibn ‘Ata’illah tells us to never give up, as we strive to get closer to Allah. No matter how many sins you might’ve have committed, or how many times you returned to the same sin, remember that redemption could be just around the corner. If you give up now, you will never reach the righteousness you were hoping for.
Despite realizing this, moving on after a sin can be a trial for many. Especially if it’s a sin we have so often repeated and we seem unable to escape it’s grasp. Along with the sin comes feelings of hopelessness and depression. It’s in these situations that we need to ask for forgiveness and move on, despite the hardship that might be involved. It’s in these situations that we need to remember quotes like this, along with other texts that mentions the forgiveness of Allah and the fact that no human being is free from error. Allah is not expecting us to be infallible. He is expecting us to commit mistakes and then to ask for forgiveness. And the cries of those who ask for forgiveness, is more dear to Him than the exaltations of those who praise him. 
An important point: It must be kept in mind that this quote doesn’t encourage one to be passive in changing oneself. We shouldn’t keep making the same mistakes, without identifying the reason for these mistakes and take action to rectify ourselves. It is from the qualities of the Awliyah (the elite believers) that even though they commit mistakes, they protect themselves from falling into the same mistakes. This means changing your environment and conduct. Maybe you need to leave some friends, who have a bad influence on you? Maybe you need to stop spending time browsing random sites on the web, if you know you end up looking at haram? Perhaps you need to spend more time listening and reading something, that have a positive impact on you?
In the end it’s a process. We try and we might fail from time to time, but all we need to do is to keep on moving. The scholars say that a person who strives to attain something, is already counted among it’s people. So if you strive towards Allah by committing yourself to positive habits and constantly rectifying your character, you could very well be counted among the winners. It’s all about staying on the path, trying new things and sticking to the one’s that work. This is the key to reaching our destination.
 Ibn ‘Ata’llah, al-Hikam (Quote taken from the English translation: “The Book of Wisdoms”, White Thread Press)
 Ibn Jawzi, Kitab al-Lata’if fi al-Wa’iz (English translation: “Seeds of Admonishment and Reform”)