I'm reading a book on basic analysis and came across the result that given a set $X$, there exists a set $\{Y : Y$ is a subset of $X\}$. The proof is left as an exercise and the hint states that one can start with the set $\{0, 1\}^X$ and apply the replacement axiom, replacing each function $f$ with $f^{-1}(\{1\})$.
While the above route isn't difficult to understand, why can't we just define the required set as: $\{f(X) \mid f\colon X \to X\}$? I suppose this also requires the axiom of replacement (the objects in question being $X$ and $f$) and looks fine to me, but there could be a problem with this reasoning, otherwise the author would've used this definition. If so, what's the problem?
Apologies if this is a really basic question, but I'm working on improving my mathematical logic skills.