The answer to your question would be that the best way to punctuate the bolded portion of the sentence is the following one: "He wrote many scholarly essays about a variety of topics,".
That is the right option because the statement is a quotation said by teacher and, as such, the comma shold be inside the quotation marks.