Magnetic field generation via the Kelvin-Helmholtz instability