Remind them to be submissive to rulers and authorities, to be obedient, to be ready for every good work,  to speak evil of no one, to avoid quarreling, to be gentle, and to show perfect courtesy toward all people.  For we ourselves were once foolish, disobedient, led astray, slaves to various passions and pleasures, passing our days in malice and envy, hated by others and hating one another.  But when the goodness and loving kindness of God our Savior appeared,  he saved us, not because of works done by us in righteousness, but according to his own mercy, by the washing of regeneration and renewal of the Holy Spirit,  whom he poured out on us richly through Jesus Christ our Savior,  so that being justified by his grace we might become heirs according to the hope of eternal life.  The saying is trustworthy, and I want you to insist on these things, so that those who have believed in God may be careful to devote themselves to good works. These things are excellent and profitable for people.
Apart from verses 4-7, the motivation for good works would be to make God happy, appease his wrath, feel good about ourselves, or impress other people. But because we have experienced the goodness and kindness of God, because we have been saved according to mercy (not by works), because the Holy Spirit has washed and renewed us, because we have been justified by grace, because we are heirs according to the hope we will inherit in glory, we can do good. God loves us, therefore we obey. This is the gospel. Man-made religion says, “I obey so that God will love me.”
We can do good because our status with God remains 100% secure and unchanged even when we fail to do a good work. We are freed from the pressure of having to do more good than bad. We are freed from the burden of the law weighing down our shoulders.
That is motivation for me to do what God created me, in Christ Jesus, to do (Eph. 2:10). If you don’t see or feel that, and if you think grace gives you a free license to “do whatever you want,” then you don’t really understand grace. People who play the “I-can-do-whatever-I-want-card” with grace have not tasted too much of grace; they have tasted too little. Indeed, they may not have tasted any at all.