From Sahih Muslim (Hadith 932):
Abu Huraira reported:The Messenger of Allah (ﷺ) while teaching us (the principles of faith), said: Do not try to go ahead of the Imam, recite takbir when he recites it, and when he says: "Nor of those who err" you should say Amin, bow down when he bows down, and when he says: "Allah listens to him who praises Him" say: "O Allah, our Lord, to Thee be the praise
Reference: Muslim 932