Consider the list of elements $e, a , a^2, a^3, b, ab, a^2b, a^3b$
If two of these are equal, then cancelling gives $a^r=b^s$ for some $r \in \{0,1,2,3\}, s\in\{0,1\}$
I am unsure about what the book's solution means by cancelling and how this result would show the list is not made up of distinct elements. But I am then told that since this is not the case, the 8 listed elements are distinct. Could someone break this down and explain?
Earlier in the question, I proved that $a^4=b^2=e$ if that helps.
I don't think a definition of the group is needed, but I will make changes to the description if there are insufficient details to answer the question.
Cancelling is multiplying both sides of an equality of the kind $$ab=c$$ by $b^{-1}$ on the right, or by $a^{-1}$ on the left, to get $$\text{either} \qquad a=cb^{-1}\qquad \text{or} \qquad b=a^{-1}c$$ In your case, you would get from $$a^nb^m=a^pb^q$$ to $$a^{n-p}=b^{q-m}.$$
Now for the second part of your question, it looks like your book is aiming at a contradiction by arguing that $k=4$ and $\ell=2$ are the smallest positive powers that allow for the equality $a^k=b^\ell$ to hold. But without more information it is impossible to tell why this should be the case here.
Note however that the sentence
should specify $r$ and $s$ not both $0$. Otherwise the statement is empty.