I'm confused about energy driven by a wave. Consider a sinousoidal wave moving in a rope.

Each element ##dm## of the rope follows a simple harmonic motion in time. That means that the mechanical energy ##dE=dK+dU## of the element ##dm## is constant.

Nevertheless on Halliday-Resnik-Krane I found this explanation.

I really do not see how this can be possible. Is this related to the fact that the energy of a wave is not concentrated in a single point but somehow spread in all the rope continuously?

I would really appreciate some suggestion on this topic. Is the mechanical energy of ##dm## really not constant? If so, what can be an explanation for that?

I believe that the authors should explain their thought detailed. Indeed, the equation of harmonic oscillator ##m\ddot x+k^2 x=0## has the first integral ##m\dot x^2/2+kx^2/2## this is a trivial mathematical fact and it does not depend on environment.
Or in other words if ##x(t)=C_1\cos\omega t+C_2\sin\omega t## then ##\dot x^2/2+\omega^2 x/2=const##