What God says does not mean, ‘If you exhibit good behaviour and a righteous life, won't you be accepted?’ Cain already evidently thinks he does that. No, this refers to the offering.
The grace which is offered to us in the gospel gives us the only viable way forward. Do men and women who refuse to come to God for mercy; do they think they can control their own lusts and keep sin at bay? Man repeatedly overestimates his own ability to control sin. He thinks he can serve at once and not give himself over to its power. But sin is a terrible fall and it always overcomes those who refuse the grace of God.