Context. The electron-cyclotron maser instability (ECMI) is a significant coherent radio emission mechanism widely utilized in various astrophysical radio phenomena. It is well known that the velocity anisotropic distribution of energetic electrons, which leads to an inverted perpendicular population in the vertical direction with ∂fb/∂v⊥ > 0, can provide the free energy necessary for the ECMI. Aims. The initial velocity distribution of energetic electrons leaving the acceleration region is typically isotropic or beam-like. However, as these energetic electrons travel along the magnetic field as fast electron beams (FEBs) in magnetic plasma, various velocity anisotropic distributions can emerge. In this paper, we examine the impact of temperature anisotropy formed by beam electrons traveling along a flare loop on the ECMI. Methods. By neglecting the energy loss of energetic electrons as they traverse the corona and invoking the conservation of energy and magnetic moments, we established the relationship between momentum dispersion and the magnetic field. Utilizing the magnetic field model of the flare loop, we calculated the evolution of momentum dispersion and the growth rates of the ECMI as FEBs precipitate along the flare loop. Results. The results demonstrate that the temperature anisotropy arising as FEBs descend along the flare loop significantly impacts the ECMI. The maximum growth rates of the excited modes exhibit a gradual increase initially and then decline rapidly after reaching a critical height for β0 = 0.2c and 0.15c. The results also show that the growth rates of the O2 mode are one order of magnitude smaller than those of the O1 and X2 modes. This indicates that the harmonic radiation is X-mode polarized. Notably, the temperature anisotropy of FEBs as they precipitate along the flare loop with different magnetic field models or at different heights has similar effects on the ECMI.