ANSWER:
The prayer was invalid.
The Rakah you prayed with the imam was your first. This means that after his salam, you should have prayed one more Rakah and sat for the tashahud as it was your second. And then you complete your 3rd and 4th Rakah.
ANSWER:
The prayer was invalid.
The Rakah you prayed with the imam was your first. This means that after his salam, you should have prayed one more Rakah and sat for the tashahud as it was your second. And then you complete your 3rd and 4th Rakah.