All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
If the mistake is in the first Tashahhud, then it is not one of the pillars of the prayer. As to the last Tashahhud, it is one of the pillars of the prayer according to some scholars, like the Hanbalis and Shaafiʻis, contrary to others. A group of the Hanbalis held that if the person misses one letter of the last Tashahhud, his prayer is invalid.
"Ibn Haamid said, 'Some of our scholars held that even if he left out one letter (of the Tashahhud), he is required to repeat the prayer.' Az-Zarkashi remarked that this was the opinion of some (Hanbalis), including Ibn Haamid and others. In Al-Furooʻ (book), he cited the narration of Ibn Masʻood about the Tashahhud and commented, saying, 'No other version of the Tashahhud is sufficient.' It was also said that if the person mispronounces or misses a letter which is not mentioned in other than it (the wording of the Tashahhud of Ibn Masʻood), then it is sufficient (i.e. his prayer is valid)." [Al-Insaaf]
However, if the dear questioner has missed a letter of the Tashahhud while being able to pronounce it but failed to do so and the time to correct it elapsed, it is permissible for him to follow the opinion of the scholars who held that reciting the last Tashahhud is an act of the Sunnah. Accordingly, the prayer is not invalidated by the mistakes made in reciting it.
Allah knows best.