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, sallallahu ʻalayhi wa sallam, is His slave and Messenger.
What we understood from your question is that you prayed the Thuhr as 2 units while you were a resident because you prayed behind an imaam who was traveling and thus shortened the Thuhr to 2 units. If this is the case, then your prayer is not valid and you have to repeat it. It is impermissible for the resident to shorten the prayer if he prays behind an imaam who is traveling and shortens the prayer. The resident, in this case, is obliged to complete the prayer individually after the imaam makes Tasleem (ending the prayer with the Salaam greeting), according to the consensus of scholars. Ibn Al-Munthir said, “The scholars unanimously agreed that if the resident is being led in the prayer by a traveler (shortening the prayer) and the imaam made Tasleem after two units of prayer, the resident must complete the prayer.” [Al-Ijmaa’]
If you repeated the prayer by joining another congregation with the intention of praying the Thuhr – as we understood from the question – then this is sufficient in clearing yourself of your liability from the obligation of praying the Thuhr.
Allah knows best.