Neither to avoid damnation nor to be good. "Good" in its truest form can only be applied to God.
Luke 18:19
19 “Why do you call me good?” Jesus answered. “No one is
good–except God alone.
I believe the answer to this question is relatively simple. The only sustainable motivation for not sinning is our love for God.
John 14:15
15 If you love me, you will obey what I command.
The Bible makes it very clear that God hates sin. When Christ took on Himself the sins of the world, both past, present and future, God turned His face away from His only son:
Matthew 27:46
46 And about the ninth hour Jesus cried with a loud voice, saying, Eli,
Eli, lama sabachthani? that is to say, My God, my God, why hast thou
forsaken me?
In 1 John, we're told that anyone who truly knows God does not continue to sin but purifies themselves for the sake of their Savior:
1 John 3:3-6
3 Everyone who has this hope in him purifies himself, just as he is
pure. 4 Everyone who sins breaks the law; in fact, sin is
lawlessness.5 But you know that he appeared so that he might take away
our sins. And in him is no sin.
6 No one who lives in him keeps on sinning. No one who continues to
sin has either seen him or known him.
Simply put: We refrain from sin, as the Spirit of God enables us, because we love God and desire to please Him and reflect His glory, not as an attempt to avoid damnation. If we could do anything to avoid Hell of our own power, there would be no need for Christ or the cross.
Christ paid the penalty for our sin out of love for His creation. Living holy, sinless lives (as the Spirit of God enables us), is the only acceptable response to His sacrifice.
2 Corinthians 5:14-15
14 For Christ's love compels us, because we are convinced that one
died for all, and therefore all died. 15 And he died for all, that those who live should no longer live for
themselves but for him who died for them and was raised again.