I have found one proposition in some papers about pure injectivity topological modules. Proposition: A topological space is categorically Top-injective if and only if it is indiscrete. Proof: $(\Leftarrow)$ Suppose that $(I,\tau)$ is a topological space where I is non-empty and $\tau$ is the indiscrete topology. Let $f$ be a continuous one-to-one function from $(Y,\tau_{1})$ to $(X,\tau_{2})$. Let $g$ be a continuous map from $(Y,\tau_{1})$ to $(I,\tau)$. Let $i\in I$. Let $h(x)=gf^{-1}(x)$ if $x\in f(Y)$ and $h(x)=i$ if $x\notin f(Y)$. Now $h$ is a continuous map from $(X,\tau_{2})$ to $(I,\tau)$ since $\tau$ is the discrete topology on I. Furthermore, $g=hf$. Therefore, $(I,\tau)$ is categorically Top-injective.
is $h(x)$ well-defined? I mean, $h(x)=i$ for every $x\notin f(Y)$ doesn't guarantee that $h(x)$ is well-defined. This proposition state that if $M$ is Top-injective, then the only topology for $M$ is trivial topology. Is it right? Thank you for any help.
The key assumption is that $f$ is injective (one-to-one), so that for each $x \in X$ there is at most one element $y \in Y$ such that $f(y) = x$.
Then, we break into cases on whether $x \in f(Y)$. If $x \in f(Y)$, then a unique $y$ such that $f(y) = x$ exists and we define $h(x) = g(y)$. Otherwise, $h(x) = i$. In the quoted text, $y$ is $f^{-1}(x)$.
There's the question of why it's justified to break into cases on whether $x \in f(Y)$. That's just the law of excluded middle.
That would be a poor way to phrase it. Any set larger than one element can be equipped with more than one topology, so for $M$ large enough, it doesn't make sense to say something is "the only topology for $M$".
To even state that $M$ is $\mathcal{Top}$-injective, $M$ has to already have a given topology. Instead you could say that this given topology on $M$ can only be the indiscrete topology if $M$ is injective.
The other half of the proposition (whose proof is included in your question) proves (almost) the converse. It shows that a non-empty indiscrete space is injective. The empty indiscrete space isn't injective.