The variation along a magnetic field line of the energy and pitch angle distribution of high energy electrons injected into a cold hydrogen plasma containing either an open or closed magnetic field structure was investigated. The problem is formulated as a time independent Fokker-Planck Equation for the electron number distribution as a function of the electron energy, electron pitch angle, and the structure of the global magnetic field. Simple analytic solution valid in the small pitch angle regime and for slowly varying magnetic field is presented. For the more general situation a numerical code for solving the Fokker-Planck Equation was used and it was found that the analytic expression agrees well with the numerical results to values of the pitch angle much larger than expected. For most practical applications, one many confidently use the analytic expression instead of having to resort to lengthy numerical computations. These results are useful in the study of the nonthermal models of the impulsive phase of solar flares.