Someone I know recently had the experience of a not-so-great second time teaching a class, even though the first time had gone really well. However difficult it is to teach (including TA) a course the first time, I think the second (or nineteenth) time can also be difficult.
There are many possible reasons, including:
Class dynamics can change a lot from year to year. This is particularly true of small classes, but also applies to even very large classes. A few students can influence the atmosphere of a class, for good or not. So, maybe the first time you teach a class you are lucky to have a really nice group of motivated, polite, and happy students. But another time.. you get some less happy students (maybe for reasons unrelated to the class and your teaching), and some of them are vocal about their unhappiness, or maybe they are quiet and sullen and stifle class discussions by their glowering hostility. Just when you were starting to feel more confident about teaching this class, you start to doubt how you are handling the class. This can be an issue no matter how many times you teach a class, but after many years, you may develop strategies for dealing with it.
Perhaps you spent so much time preparing for the class the first time that you thought you could spend much less time the second time around. In fact, you may well be able to spend a lot less prep time the second time around, but beware: you may think that a lecture or lab that you spent hours creating and organizing the first time is fresh in your mind, but then when you're standing in front of the class, you realize you should have spent more time thinking about how to explain the concepts, the logic of the order in which you present the concepts, and in-class questions/activities to engage the class in the lecture material. You likely don't have to spend as much time as you did when you first taught the class, but, for some people (i.e., me), it can still take a lot of preparation to teach something again. It's easy to underestimate the time required.
The first time you taught the class, your life was simpler. You did not have as many other courses to teach, you weren't on so many committees, you didn't have as many (or any) children or pets or research grants or graduate students or postdocs. Things have gotten more complicated and hectic, and you don't have as much time to devote to preparing for the class or to helping students. You don't feel as organized and coherent as you did when you had time to prepare and teach the course the first time. The students sense that you are extremely busy, and some interpret this to mean that you care more about other things than about them.
There are some courses that I have taught so many times and with a reasonable amount of success (based on teaching evaluations) that I wonder how I would recognize if I needed to make a major change in the course and how I teach it. For example, if there were more than a few unhappy students in one of these oft-taught courses, would I just think to myself "I've taught this course n > 10 times without these problems, it must be their fault, not mine"? Maybe I would. Maybe I would be right, but maybe I would be wrong.
Early in my career, I thought that when I had taught a course n > 5 (or 10) times, I would eventually find the "best" way to teach the course, and then I would teach it that way forever. Now I think that the best way for me to teach is to find a happy balance between being sufficiently prepared (but not obsessively so), confident (but not too confident), and alert to the need for adjustments in the course depending on changes in the student population, course material (new advances in Science), life, the universe, and everything and anything.
6 months ago