Don't give up just because a few of your students didn't seem to take your teaching to heart. Undoubtedly, many have profited from your teaching -- and even those who've gotten in trouble may recall something you said and turn to Christ for forgiveness and new life.
Do you remember Jesus' parable of the seed and the sower? (You can find it in Luke 8:1-15.) In it, Jesus said that the Word of God is like seed, and when we sow it (just as a farmer does), some may land on hard or rocky ground and not grow. But some falls on fertile soil -- and there it produces a bountiful crop. What Jesus was telling us is that there is power in God's Word, and when we teach it, some lives will be changed. The Bible says, "'Is not my word like fire,' declares the Lord, 'and like a hammer that breaks a rock in pieces?'" (Jeremiah 23:29).
Ask God to help you be the best teacher you can possibly be. Prepare well; don't leave everything to the last minute. Pray for your class, that God will open their hearts to His truth. Always focus on Christ and what He has done for us, and urge your students to commit their lives to Him.
Some day, God may want you to step aside -- but don't do it until He tells you. In the meantime, be faithful to Christ, both in your teaching and your life.