Effective Hamiltonian and dynamics of edge states in two-dimensional topological insulators under magnetic fields