The argument in your book is heuristic, that is it presents a reasonable justification for the de Broglie wavelength but it is not a proof.
The correct expression for the de Broglie wavelength is:
$$ \lambda = \frac{h}{p} \tag{1} $$
For a massive particle in the non-relativistic limit the momentum is given by:
$$ p = mv $$
so we can write equation (1) as:
$$ \lambda = \frac{h}{mv} $$
For a photon we can use the relativistic equation linking energy and momentum:
$$ E^2 = p^2c^2 + m^2c^4 $$
And since for a photon $m=0$ this gives us $E=pc$ and therefore equation (1) becomes:
$$ \lambda = \frac{hc}{E} $$
Rearranging this gives the usual expression:
$$ E = \frac{hc}{\lambda} = h\nu $$
By comparison with a massive particle it is tempting to write the momentum of a photon as:
$$ p = mc $$
where $c$ is the photon velocity and $m$ is some hypothetical mass given by $E/c^2$. Indeed if we substitute $m=E/c^2$ in the above equation we get back the correct relativistic result:
$$ p = \frac{E}{c^2}c = \frac{E}{c} $$
But this is just numerology. The photon does not have a mass in any useful sense of the word.