9V block batteries are unable to supply the current required by motors. They are intended for smoke alarms and the like. Use a “wall wart” (AC to DC power adapter) that can supply 9 to 12V at a couple of Amps and connect all the grounds together.
Furthermore, the L298 is pretty ancient technology and cannot handle the current demanded by many motors. Can you post a link to the product page or data sheet for the motors?