The generation and evolution of localized waves on an impurity in the scattering of a kink of the sine-Gordon equation are studied. It is shown that the problem can be considered as excitation of oscillations of a harmonic oscillator by a short external impulse. The external impulse is modeled by the scattering of a kink on an impurity. The influence of the modes of motion of a kink on the excitation energy of localized waves is numerically and analytically studied. The method of collective coordinate for the analytical study is used. The value of this energy is determined by the ratio of the impurity parameters and the initial kink velocity. It is shown that the dependence of the energy (and amplitude) of the generated localized waves