Why did you despise the word of the Lord by doing what is evil in his eyes? You struck down Uriah the Hittite with the sword and took his wife to be your own. You killed him with the sword of the Ammonites.
2 Samuel 12:9 NIV
David made a series of blunders that led to murder, all because he did not confess his sin and repent early on. He first did not go out to war with his men, and then when he observed Bathsheba bathing, he did not resist the temptation but instead pursued his desire and slept with her even though it was a clear violation of God's command. Then he tried to cover it up to make it look like her husband had slept with her, and then when that backfired he ensured her husband was killed. David would have never started out with murdering an innocent man, but because he allowed his sin to continue instead of facing the shame of confessing it, his actions resulted in horrible consequences for him and his family.
As painful or shameful as it is to confess sin and repent, do it early and often. Do not allow sin to fester, because it will compound in severity and consequence.
Lord, I am blown away by your grace and mercy. Thank you that even when we find ourselves mired in sin, you will forgive us when we have a broken and contrite heart (Psalm 51:17). Holy Spirit, please speak loudly to me. Help me to hear Your voice and confess my sin early. Let me not proceed deeper into sin and thus grieve you even more deeply and have worse consequences to face. Give me strength and courage to follow You and always do what is right. I love you.