Study of Charm Fragmentation into D*+- Mesons in Deep-Inelastic Scattering at HERA