I don't think you're quite there yet. Let me walk you through the proof.
Suppose $B \subseteq \text{range}(f)$.
So far, so good!
*Then, for some $y\in B$, we have $y \in \text{range}(f)$.
What do you mean with some? Do you mean to say that there exists $y\in B$ with this property, or do you mean to say that it holds for all $y\in B$?
**Thus, it follows that $f^{-1}[B] \cap f^{-1}[T\setminus B] = \varnothing$.
I'm not sure what you want with this. In fact, this is true for any set $B \subseteq T$, regardless of the assumption $B \subseteq \text{range}(f)$. It just says that there is no element $s\in S$ that is simultaneously sent to $B$ and to $T\setminus B$.
More generally, we have $f^{-1}[U \cap V] = f^{-1}[U] \cap f^{-1}[V]$. From this it follows that the following holds for any subset $B \subseteq T$:
$$ f^{-1}[B] \cap f^{-1}[T \setminus B] = f^{-1}[B \cap (T \setminus B)] = f^{-1}[\varnothing] = \varnothing. $$
Thus, $f[f^{-1}[B]] = B$.
By now you've lost me. :-( I don't see how this follows from any of the above. Maybe there is a simple fix in one of the steps which repairs the entire proof, but I just don't see it.
When working with images and preimages like these, I find it useful to prove the result element by element. Like this:
- Let $x\in B$ be given, then prove that $x \in f[f^{-1}[B]]$ holds. This shows an inclusion $B \subseteq f[f^{-1}[B]]$.
- Let $x\in f[f^{-1}[B]]$ be given, then prove that $x \in B$ holds. This proves the inclusion $f[f^{-1}[B]] \subseteq B$.
Hint: you only need the assumption $B \subseteq \text{range}(f)$ for one of these inclusions; the other one is always true.