We know from basic math that we have a function $f:X \rightarrow Y$ if $x \in X$ maps to exactly one element in the codomain Y.
My question is that if we consider the morphism in categories as a generalization of function, a morphism had to be the condiction of well defined?
I don't know if this is a stupid question, but it raises when i'm reading about posets categories. If we see the partial order $\leq$ as a morphism in a partial ordered set, then a element in this set maps not necessary maps to just one element. In other words, if we have the set X={1,2,3,4) and the partial order $\leq$, we have that $1 \leq 2$ and $1 \leq 3$, etc.
The partial order above is a morphism? This morphism needs to be well defined?
While your question has been addressed pretty well in the comments, I wanted to address the question with examples, but also provide a possible way of seeing morphisms as functions as well.
First, as the comments have mentioned, the morphisms of a category certainly do not have to be "functions" like they are in the category $\mathbf{Set}$ of sets; all that's necessary is that the morphisms satisfy the appropriate axioms (i.e., they have an associative composition, and there exist identity morphisms).
So, in summary, morphisms of a category are not functions in the naïve interpretation. However, there is a way to make them look like functions, and the way to do this is to rephrase what you mean by "elements."
To illustrate what I mean, consider $\mathbf{Set}$ (where the morphisms are precisely the functions of sets). Let $X$ be a set, then there is a natural correspondence between elements $x\in X$ and functions $\bar x:*\to X$ (where $*$ is a fixed choice of one-element set). If we think of elements as maps $*\to X$, then given a function $f:X\to Y$, "evaluation at $x$" translates to "composition with $\bar x$": the element $*\to Y$ corresponding to $f(x)$ is precisely $f\circ\bar x:*\to X\to Y$.
We can play a similar game with the category $\mathbf{Ab}$ of abelian groups and group homomorphisms. Fix an abelian group $A$. Since there is only one morphism $\{0\}\to A$, we have to use a different domain than the trivial group, but it can still be done: elements $g\in A$ correspond to group homomorphisms $\bar g:\Bbb Z\to A$ (here, the correspondence has $\bar g(1):=g$). Therefore, we can think of morphisms $\varphi:A\to B$ as functions mapping "elements" $\Bbb Z\to A$ to "elements" $\Bbb Z\to B$.
In a general category $\mathcal C$, we can't expect that exactly this story works: there won't always exist some object $S\in\mathcal C$ so that elements of any $X\in\mathcal C$ correspond to morphisms $S\to\mathcal C$ (like I mentioned before, there isn't even a good reason to expect that objects of $\mathcal C$ has elements), but why restrict ourselves to just one object $S$? This is where the perspective of generalised elements comes to play: we can think of morphisms $S\to X$ as "$S$-shaped elements" of $X$.
Now, given an object $X$ and a morphism $f:X\to Y$, we can think of $f$ as a function of "$S$-shaped elements $x:S\to X$" into "$S$-shaped elements $f\circ x:S\to Y$", allowing ourselves to vary $S$ freely. This perspective can sometimes come in handy when looking at certain constructions and definitions in category theory: for example, a morphism $f:X\to Y$ is monic (the categorical analogue of "injective") if it is injective as a function of $S$-shaped elements in $X$ for all $S$: given $x,y:S\to X$, if $f\circ x=f\circ y$, then $x=y$.
This is also a helpful perspective for limits. For example, given two objects $X$ and $Y$, their product is the object $X\times Y$ such that for any pair of $S$-shaped elements $x:S\to X$ and $y:S\to Y$, there is a unique $S$-shaped element $(x,y):S\to X\times Y$ whose components are $x$ and $y$. This reveals how the categorical product corresponds to the Cartesian product in $\mathbf{Set}$!
Finally, I want to mention that this perspective is not magical, but is really a way of interpreting the Yoneda embedding: you can think of an object $X\in\mathcal C$ as an $\operatorname{Ob}(\mathcal C)$-indexed collection of "sets" $\operatorname{Hom}_{\mathcal C}(S,X)$ (the set of $S$-shaped elements in $X$), and in this way, a morphism $X\to Y$ is an $\operatorname{Ob}(\mathcal C)$-indexed collection of "functions" $\operatorname{Hom}_{\mathcal C}(S,f):\operatorname{Hom}_{\mathcal C}(S,X)\to\operatorname{Hom}_{\mathcal C}(S,Y)$.