Since the value of the car is not specified after 2 years, we will assume it is zero.
Then the total cost is
... car cost + 2×(insurance cost + maintenance cost + gas cost)
... = 5000 + 2×(1500 + 400 + (12000/20*2.50))
... = 5000 + 2×(1900 + 1500)
... = 11,800
This is the cost for driving 24,000 miles, so the cost per mile is
... 11,800/24,000 ≈ 0.49167
Your average cost per mile will be about $0.49.
_____
The purchase price of the car is about 42% of that cost, so the operating cost is reduced somewhat if there is resale value at the end of 2 years.