What exactly does a motor driver do ? Why do we need additional power supply for motors. I'm a hobbyist. making a line follower from scratch.
If a DC motor is being connected to something like a microcontroller's I/O, the I/O pins usually are only capable of supplying currents in the order of mA. Motors need much higher current to actuate themselves, so typically a motor driver is used. A motor driver is merely a current amplifier, even a push-pull transistor pair can be used to achieve that. Another function that motor drivers commonly perform is to isolate low power electronics from the high power supply that usually runs a motor. A more commonly used implementation is called an H-bridge: https://en.wikipedia.org/wiki/H_bridge
If you're talking about stepper motors though, this becomes a more complicated process. Stepper motor operation involves attraction between rotor and stator magnets, and a reversal of stator poles is one of the things that takes place. But the motor winding, being a coil, usually has its own inductance, and high drive voltages are necessary to overcome this inductance and cause the reversal. Hence, stepper motor driver circuits are usually more complicated, which are responsible for both generating high voltages and also controlling current to each winding, making sure it doesn't exceed a certain value etc.
So mainly, any motor usually needs a driver circuit because its voltage/current requirements are different from the device that's trying to control it.
At a high level, a motor driver takes a "logic-level" input (desired "effort") and delivers a corresponding "high-side" output to the motor. Exactly what is inside the motor driver depends on the motor and driver (for example brushed and brushless motors are driven very differently). Larger motors like the ones in quadcopters or higher end remote control cars tend to be brushless motors, which are driven using carefully offset sinusoidal inputs (very roughly speaking). A smaller line-follower robot will typically use a brushed motor, which can be controlled using simpler circuits such as an H-bridge.
There are several reasons to "isolate" the motor and control power supplies.
Motors have a lot of electrical "inertia" (inductance) which translates into a lot of electrical noise pushed back into the power supply. Microcontrollers are built assuming that the input supply is reasonably "clean", and this noise can reset your control circuitry (best case), or burn out internal components (worst-case).
Motors often have higher voltage and current requirements than control circuitry. For example the digital outputs of an aruino can put out around 100mA at 5 volts (which might be enough for a small line follower). A brushless motor used on a small fixed wing aircraft such as the Zephyr II can draw 100 amps at 12 volts.
Note that you do not need a separate battery for the controls and motor power, but you should have separate circuitry which "cleans" the raw battery voltage (such as an LDO or buck converter) before sending it to the control circuitry.
Main work of motor driver is to supply power to motor from external source by taking inputs from logics from microcontroller because microcontroller output will be in milliamps.Another use is to change the direction of rotation of motor