If the reality is as you have mentioned with regard to a contract between you, then the first transaction is invalid because
he sold you the car before possessing it. This is a legally prohibited transaction. But agreeing to pay him in cash the price he (Part No. 13; Page No. 243) has paid to buy this car is permissible. We ask Allah to forgive you for buying it before the seller possessed it. You do not have to pay anything other than the agreed upon price. But you have to repent to Allah and seek His forgiveness for your first transaction.
May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.