Because that's where the progress was. They simply couldn't make progress on batteries at the time.
Making better engines is a question of manufacturing and metallurgy, stuff that is well within scope for the world as it existed 100yr ago. Making better batteries requires a much higher state of technological progress because you first need to understand chemistry at a much greater level and the fairly finicky chemistry involved has a lot of manufacturing progress as a prerequisite.
There's a reason we didn't get economically viable and high enough performance batteries for consumer electronics (say nothing of power tools and cars) until after we developed computer controlled industrial manufacturing processes.
Basically all the stuff you need to build good ICE cars you will need to develop on your way to developing good batteries. They built engines instead of batteries for the same reason the Romans built with stone instead of steel.