Hitting and shouting are not things that break the fast, even if it is done by way of aggression, so how about if the hitting and shouting are done for the purpose of discipline, teaching and directing? Undoubtedly in that case it is clear that they do not break the fast. Please see the answer to question number 106473.
We advise you to remain in this job -- teaching -- because it is one of the noblest and most important kinds of work, and it is essential to pay attention to knowledge and teaching, and to make sacrifices for the sake of reviving our schools and universities and taking them to the highest levels and most sublime of goals. Try to overcome every problem you face in your work with wisdom and deliberation, and consult former teachers who have experience.
We ask Allah to guide and help us and you in this world and to grant us success in the Hereafter.
And Allah knows best.