There is only one sin which cannot be forgiven.
Mark 3:28 Verily I say unto you, All sins shall be forgiven unto the sons of men, and blasphemies wherewith soever they shall blaspheme:29 But he that shall blaspheme against the Holy Spirit hath never forgiveness, but is in danger of eternal damnation:
David received forgiveness for adultery and murder.
If we want forgiveness for sin God requires a response from us.
1. We must understand and believe the gospel preached by Jesus Christ and his apostles.
2. We must repent of our sinful way of life – that is – change the way that we live.
3. We must be baptised by immersion in water for the remission of our past sins.
4. After baptism we must live a new life by the commandments of Christ.
5. After baptism we will still sin, but providing we are making a determined effort to live by Christ’s commandments, our sins will be forgiven by confession in prayer.
6. We must hold fast to our faith until the end of our lives.
7. When Christ returns, we will be raised from the dead for judgment and the faithful will receive eternal life.
8. Our judgment will be just.
The relevant scriptures are as follows:
Matthew 28:19 Go ye therefore, and teach all nations, baptizing them in the name of the Father, and of the Son, and of the Holy Spirit: 20 Teaching them to observe all things whatsoever I have commanded you:
Mark 16:15... Go ye into all the world, and preach the gospel to every creature. 16 He that believeth and is baptized shall be saved; but he that believeth not shall be damned.
Acts 2:38... Repent, and be baptized every one of you in the name of Jesus Christ for the remission of sins…
Acts 22:16 And now why tarriest thou? arise, and be baptized, and wash away thy sins, calling on the name of the Lord.
Romans 6:4 Therefore we are buried with him by baptism into death: that like as Christ was raised up from the dead by the glory of the Father, even so we also should walk in newness of life.
John 15:14 Ye are my friends, if ye do whatsoever I command you.
James 1:22 But be ye doers of the word, and not hearers only, deceiving your own selves.
1 John 1:7 But if we walk in the light, as he is in the light, we have fellowship one with another, and the blood of Jesus Christ his Son cleanseth us from all sin. 8 If we say that we have no sin, we deceive ourselves, and the truth is not in us. 9 If we confess our sins, he is faithful and just to forgive us our sins, and to cleanse us from all unrighteousness.
Matthew 24:13... he that shall endure unto the end, the same shall be saved.
Romans 14:10… we shall all stand before the judgment seat of Christ.
John 5:28 Marvel not at this: for the hour is coming, in the which all that are in the graves shall hear his voice, 29 And shall come forth; they that have done good, unto the resurrection of life; and they that have done evil, unto the resurrection of damnation.
Galatians 6:7 Be not deceived; God is not mocked: for whatsoever a man soweth, that shall he also reap. 8 For he that soweth to his flesh shall of the flesh reap corruption; but he that soweth to the Spirit shall of the Spirit reap life everlasting.
May I suggest that you read:
Your Share in God's Promises: https://www.thisisyourbible.com/library/show/181
I hope this helps