Convergence of a finite difference method for the KdV and modified KdV equations with $L^2$ data