ANSWER:

What you did was not correct. You should not have broken the salah. 

When you realized that you got up for the third rakah you should have immediately gone back to sitting position and finished your prayer and made sujood as sahu. 

Sheikh,I was praying Fajr,I broke it,cause I forgot I only needed to pray 2 rakahs.I realized when I got up from tashahhud,about to recite Surah Al-Fatiha,but I cut off.I said Astaghfirullah & began to pray again by making sure that I only need to pray 2 rakahs of Fajr.What I did was correct?

Prayer |