The Role of Ambipolar Diffusion in the Formation Process of Moderately Magnetized Diffuse Clouds