As a TA, what should I do about an error in the professor's lecture that I repeated in the lecture notes?
Just tell the professor: "The transcription of the lecture included an error, and many students made the same error on the midterm." (It really doesn't matter whether the mistake was made first in the lecture or the notes.)

He will decide what to do about the midterm.

He will almost certainly be very happy to hear about his error from you, rather than from a large number of irate students (which is likely to happen if you don't tell him).

Nobody is infallible - not professors, not teaching assistants, not students. If he gets mad at you for preparing "bad lecture notes" for proliferating one mistake that he made, he is completely unreasonable.

As an aside: this evening, I gave my students a quiz, and during the quiz my TA - who was helping me proctor - pointed out an error. I thanked him and told the students to disregard that question.  Then, after the quiz, I had the students get together in groups and work on "fixing" the question (the nature of the error made the fix non-trivial). It was an interesting and helpful educational exercise, for my students and for me. Errors can sometimes be an opportunity for good things.

Of course, I told my students that this is an important lesson on the dangers of taking code snippets off the Internet or from a book without carefully checking them :)