We derive the complex Ginzburg-Landau equation for the dynamical self-diffraction of optical waves in a nonlinear cavity. The case of the reflection geometry of wave interaction as well as a medium that possesses the cubic nonlinearity (including a local and a nonlocal nonlinear responses) and the relaxation is considered. A stable localized spatial structure in the form of a dark dissipative soliton is formed in the cavity in the steady state. The envelope of the intensity pattern, as well as of the dynamical grating amplitude, takes the shape of a $tanh$ function. The obtained complex Ginzburg-Landau equation describes the dynamics of this envelope, at the same time the evolution of this spatial structure changes the parameters of the output waves. New effects are predicted in this system due to the transformation of the dissipative soliton which takes place during the interaction of a pulse with a continuous wave, such as: retention of the pulse shape during the transmission of impulses in a long nonlinear cavity; giant amplification of a seed pulse, which takes energy due to redistribution of the pump continuous energy into the signal.