We can’t earn God’s forgiveness – it must be given. Jesus gave His life as a sacrifice so that we could be forgiven.
But God shows his love for us in that while we were still sinners, Christ died for us. Romans 5:8
For the wages of sin is death, but the free gift of God is eternal life in Christ Jesus our Lord. Romans 6:23