The Act of Contrition is traditionally used in when confessing one’s sins in the sacrament of Penance and Reconciliation. One of the requirements for forgiveness is contrition, that you are actually sorry for your sins.
A pious practice is also to pray the Act of Contrition daily after doing an examination of conscience.
The Act of Contrition
O, my God, I am heartily sorry for having offended you and I detest all my sins, because of your just punishments but most of all because I have offended you, my God, Who are all good and deserving of all my love.
I firmly resolve, with the help of your grace, to sin no more and avoid the near occasions of sin.
This is the traditional Act of Contrition prayer. In confession it’s not required that you pray this exact prayer. It is often provided on a sheet in the confessional and it is certainly acceptable. However, you can use other words to express the sorrow you have for your sins and your desire not to sin again.