Show that $\operatorname{rank}(A) = \operatorname{rank}(B)$
We have $A(I-(A+B))=-AB$ and $(I-(A+B))B=B-AB-B^2=-AB$ hence $$A(I-(A+B))=(I-(A+B))B.$$ Denoting $P:=I-(A+B)$, we can seen, multiplying the last equation on the left by $P^{—1}$, that $P^{-1}AP=B$, hence $A$ and $B$ are similar.
Your mistake is that you used $AB=BA$ which is not assumed (and you deduce that $A=B$, which may not occur).