Allah asks these 2 things of us when we commit sins. There are 2 types of sins. One is major, one is minor. When a minor sin is committed, if you do a good deed afterwards, you are forgiven. When we commit a major sin it takes repentance to be forgiven.
Shaytaan attacks us in this situation. Shaytaan makes us commit the sin in the first place and then after we repent, he makes us doubt Allahs mercy.
We need to strike a balance. We will tackle Shaytaan, we won’t allow him affect our relationship with Allah. Allah comforts us by telling us who will earn paradise.
Allah tells us you may have committed adultery, took drugs, gambled, but if you sought forgiveness AND changed your ways, then paradise was created for people like you! SubhanAllah!