understanding echo cancellation model
It's probably more straightforward to first compute the total transfer function in terms of $H(z)$, then plug in the actual expression for $H(z)$, and from that write down the difference equation:
$$Y(z)=X(z)+\alpha z^{-M}H(z)Y(z)\tag{1}$$
From $(1)$ we can derive the total transfer function:
$$\frac{Y(z)}{X(z)}=\frac{1}{1-\alpha z^{-M}H(z)}\tag{2}$$
Plugging $H(z)=(1-\lambda)/(1-\lambda z^{-1})$ into $(2)$ gives
$$\begin{align}\frac{Y(z)}{X(z)}&amp;=\frac{1}{1-\alpha z^{-M}\frac{1-\lambda}{1-\lambda z^{-1}}}\\&amp;=\frac{1-\lambda z^{-1}}{1-\lambda z^{-1}-\alpha(1-\lambda)z^{-M}}\tag{3}\end{align}$$
Eq. $(3)$ is equivalent to
$$Y(z)=\big(1-\lambda z^{-1}\big)X(z)+\big(\lambda z^{-1}+\alpha(1-\lambda)z^{-M}\big)Y(z)\tag{4}$$
from which you can directly see the corresponding difference equation.