Prophet Muhammad (peace be upon him) said: “I swear by Him in whose hand is my soul, if you were a people who did not commit sin, Allah would take you away and replace you with a people who would sin and then seek Allah’s forgiveness so He could forgive them.” [Sahīh Muslim (2687)]
Allah already has a creation which is sinless. He has the angels who “never disobey Allah in what He commands them and carry out whatever they are told to do.” [Sūrah al-Tahrīm: 6] they glorify Allah without fail. Some arer standing in prayer, some are bowing, and some are in prostration saying: “Glory be to the the possessor of the dominion and its possessions! Glory be to the possessor of might and irresistible power. Glory be to the Living One who never dies!”

The Prophet (peace be upon him) said: “I see and hear what you do not. The heavens heaved, and they have a right to do so, since there is not a place the width of a handspan that is not occupied by an angel prostrating his forehead to Allah.” [Sunan al-Tirmidhī (2312) and Sunan Ibn Mājah (4190)]

In spite of all this, Allah in His wisdom wanted to create beings besides the angels – human beings who would need to be guided to the proper path and who were capable of going astray. Allah says: “Lo! We have shown him the way, whether he be grateful or disbelieving.” [Sūrah al-Insān: 3]

This is the nature upon which Allah created the human being. It is unavoidable that people will err. Therefore Allah has permitted us to ask His forgiveness. Indeed, He exhorts us to do so, and He promises us His forgiveness.

We should make it a habit to seek Allah’s forgiveness as often as we can. Constancy in beseeching forgiveness is a cure for the maladies of the heart as well as a means of having our sins erased.

How much Allah is willing to forgive us can be seen in the following hadith related in Sahīh al-Bukhārī and Sahīh Muslim:
Someone committed a sin and then said: “O Allah! Forgive me my sin.”

Allah said: “My servant committed a sin, but knew that he has a Lord who forgives sins and punishes sins.”

Then he committed the sin again and said: “My Lord! Forgive me my sin.”

Allah said: “My servant committed a sin, but knew that he has a Lord who forgives sins and punishes sins.”

Then he committed the sin again and said: “My Lord! Forgive me my sin.”

Allah said: “My servant committed a sin, but knew that he has a Lord who forgives sins and punishes sins. Do as you will, for I have forgiven you.” [Sahīh al-Bukhārī (7507) and Sahīh Muslim (2758)]
We understand from this hadīth that when Allah forgives a sin, it is forgiven. If the person commits the same sin again, Allah will not revoke His forgiveness for the previous time the sin was committed, but will only hold the sinner to account for the present occurrence. Forgiveness is something Allah gives, and He does not revoke what He gives. Once a sin is wiped from our records, it is wiped away for good.

Someone asked me about the hadith: “Committing a sin after repenting for it is worse than committing it seventy times before repenting.”

I told him that this hadith is unauthentic. It is not established with a sound chain of transmission back to the Propjet (peace be upon him). Moreover, the Qur’an and authentic Sunnah are quite clear that no matter how often a person commits a sin and repents, Allah will accept that person’s repentance. Whenever someone beseeches Allah’s forgiveness in earnest, Allah will forgive that person’s sins without reservation.