We study the transfer of energy between different scales for forced three-dimensional magnetohydrodynamics turbulent flows in the kinematic dynamo regime. Two different forces are examined: a nonhelical Taylor-Green flow with magnetic Prandtl number P(M) = 0.4 and a helical ABC flow with P(M) = 1. This analysis allows us to examine which scales of the velocity flow are responsible for dynamo action and identify which scales of the magnetic field receive energy directly from the velocity field and which scales receive magnetic energy through the cascade of the magnetic field from large to small scales. Our results show that the turbulent velocity fluctuations in the inertial range are responsible for the magnetic field amplification at small scales (small-scale dynamo) while the large-scale field is amplified mostly due to the large-scale flow. A direct cascade of the magnetic field energy from large to small scales is also presented and is a complementary mechanism for the increase of the magnetic field at small scales. The input of energy from the inertial range velocity field into the small magnetic scales dominates over the energy cascade up to the wave number where the magnetic energy spectrum peaks. At even smaller scales, most of the magnetic energy input is from the cascading process.