The stellarator impurity transport code has been developed to describe the evolution of the impurity concentration and convective and diffusive fluxes of different charge states in time and space for given background plasma profiles in nonaxisymmetric devices. An extended model of neoclassical transport coefficients obtained by benchmarking of various methods has been employed for calculation of the radial electric field and for description of impurity ions. Calculations were performed mainly for light impurity species for background plasma profiles in high-density long-pulse Large Helical Device (LHD) discharges with and without an externally induced island at the edge and for W7-AS discharges with low and high confinement. It is shown that in the frame of neoclassical theory, the forces due to the radial electric field, the temperature gradient (convective terms), and the density gradient (diffusive term) mainly determine the impurity dynamics and eventually, together with atomic processes, the radial distribution of each ionization stage. Calculations show that in LHD discharges a different sign of the electric field (measured in experiment) within the island ensures the effective pumping of impurities within the island and their screening from penetration into the bulk plasma. It is shown that in the frame of purely neoclassical theory, the retention of impurities at the plasma edge, seen in the high-density H-mode of operation in W7-AS, cannot be explained.