Evolution of Magnetic Field and Nonthermal Electrons of CMEs and CME-Driven Shocks from Low to Middle Corona