Moulana Rumi (Raheemahullah) says in one place:
The vehicle of repentance is a wonderful means of conveyance.
Within a moment it moves us from the lowliness of sin
And takes us for a tour of the celestial bodies.
And he who repents to Allah becomes Allah’s beloved,
Reaching Him, cleansed and forgiven.
One should never commit sins with this idea in mind that afterwards one is going to repent, because the ability to repent does not lie in our hands. It is possible that because of our boldness and audacity and our insulting attitude, the ability and guidance towards repentance can be taken away from us. That could mean that without repentance for sins committed, one can become and remain rejected.
The example of tawbah (repentance) is like a person saying: “This ointment is very beneficial and good for burns.” Relying on this ointment, will a person place his hand in fire? No. The ointment is to be used for accidents. Not that one should purposely burn his hand in fire and then test the ointment. Similarly, for sins and their darkness and the fire which causes damage to the heart, distances one from Allah and causes His displeasure, tawbah makes amends. Tawbah is the ointment and antidote for the wounds caused by the fire of sins. But to reckon that I am purposely going to commit sin, is just like putting your hand in the fire to test the beneficial nature of the ointment. This is foolish indeed.
One should avoid all sins, even at the cost of his life. To retain this resolute intention, one should make contact with the saints of Allah, choose a good environment and inculcate within oneself the habit of performing Zikr profusely. If in spite of all these efforts to avoid sin, due to human weakness, a sin does occur, then in such a case crying in grief
Taken from Ma-aarif-e-Mathnavi, a commentary of the Mathnavi by Shaykh Hakeem Akhtar (Raheemahullah)