Let us consider the sequence space $\ell_{1}$. Next, let $\mathcal{X} \subset \ell_{1}$ be a subset of $\ell_{1}$ of all vectors with non-negative elements.
Can we then define operator $f: \mathcal{X} \to \mathcal{X}$, such that for $x\in \mathcal{X}$ we have $f(x) = sort(x)$, where $sort$ is sorting in non-increasing order. I mean, is the operator $f$ well-defined?
Yes, the function $f$ is well-defined, because for each element $x\in\mathcal X\subset \ell^1$ we have $$\|x\|_{\ell^1} = \|\operatorname{sort}(x)\|_{\ell^1},$$ and therefore you have $f(x)\in\mathcal X\subset\ell^1$.
slightly Off-topic: Note that $f$ is not linear, but it can be shown to be Lipschitz-continuous, but this is not so simple to show.