The lower branch is taken if the input ends in $\ldots 1$. In that case we want to replace trailing $\ldots 011\ldots 1$ with $\ldots 100\ldots 0$ (or exceptionally $B11\ldots 1$ with $100\ldots 0$). Hence, as long as we read $1$, we must write $0$ and move left; only when we read $0$, we must write $1$, move left, and proceed looking for the left end (as $q_2$ does)
The lower branch is taken if the input ends in $\ldots 1$. In that case we want to replace trailing $\ldots 011\ldots 1$ with $\ldots 100\ldots 0$ (or exceptionally $B11\ldots 1$ with $100\ldots 0$). Hence, as long as we read $1$, we must write $0$ and move left; only when we read $0$, we must write $1$, move left, and proceed looking for the left end (as $q_2$ does)