What should one do if one is uncertain whether he/she have recited tashaud(of second rakat) or not?

If realising after being in third rakat then continue the prayer until the end and do sajdah Sahw at the end.