Salvation is a gift of God.
Romans 6:23 KJV
For the wages of sin is death; but the gift of God is eternal life through Jesus Christ our Lord.
Like any other gift it matters how you receive it and if you decide to keep it.
When a gift is offered you have to receive it. This is known as acceptance. Do you accept Jesus as the Son of God? Do you accept his sacrifice on the cross as an offering for your salvation? John 3:16, John 3:18, Hebrews 7:26-27, Hebrews 9:14
Have you been baptized in water for the remission of sins in the name of Jesus Christ?
Acts 22:16 KJV
And now why tarriest thou? arise, and be baptized, and wash away thy sins, calling on the name of the Lord. See also Acts 2:38.
Have you decided to keep your salvation?
1 John 1:7-9 KJV
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.  If we say that we have no sin, we deceive ourselves, and the truth is not in us.  If we confess our sins, he is faithful and just to forgive us our sins, and to cleanse us from all unrighteousness.