Context. Spectral lines of helium are commonly observed on the Sun. These observations contain important information about physical conditions and He/H abundance variations within solar outer structures. Aims. The modeling of chromospheric and coronal loop-like structures visible in hydrogen and helium lines requires the use of appropriate diagnostic tools based on NLTE radiative tranfer in cylindrical geometry. Methods. We use iterative numerical methods to solve the equations of NLTE radiative transfer and statistical equilibrium of atomic level populations. These equations are solved alternatively for hydrogen and helium atoms, using cylindrical coordinates and prescribed solar incident radiation. Electron density is determined by the ionization equilibria of both atoms. Two-dimensional effects are included. Results. The mechanisms of formation of the principal helium lines are analyzed and the sources of emission inside the cylinder are located. The variations of spectral line intensities with temperature, pressure, and helium abundance, are studied. Conclusions. The simultaneous computation of hydrogen and helium lines, performed by the new numerical code, allows the construction of loop models including an extended range of temperatures.