Modern gasoline engines have a maximum thermal efficiency of about 20% to 35% when used to drive a car. Although the gasoline engine can be up to around 40% efficient (thermal efficiency), there is friction heat loss all along the way (drive train), such that not all the engine's mechanical energy is used moving the car along the road. Assuming the poorly running engine is only 20% efficient, how many kWh are actually used to move the car a mile?

I see this question posted again and again. As stated it is nonsense. We have no idea how big the vehicle is and how much power it uses. If it is 20% efficient it uses the perfect power / 0.20. However you did not say what the power is at 100 percent or at 40 percent