Nonlinear evolution of cosmic magnetic fields and cosmic microwave background anisotropies