Using only 3 batteries in a 4-battery pack and managing L298 driver

Connect like this:

Do not use the breadboard for making the ground connection of the battery. Connect both battery plus and minus directly to the L298 as I show.