Let $X$ be a set
Prove that the family $S=X^X$ of functions $X\to X$ with the operation of composition is a semigroup
Let $f(x),g(x),h(x): X\to X$
$(f\circ g)\circ h(x)=\large{g(x)^{f(x)^{h(x)}}}$ and $f\circ (g\circ h(x))=\large{h(x)^{g(x)^{f(x)}}}$ or I did not get the $X^X$ function right
It looks like you're working with the wrong definition of the composition operation. If $f_1, f_2 : X \to X$ then $f_1 \circ f_2$ is a function $X \to X$ defined as $(f_1 \circ f_2)(x) = f_1(f_2(x)), \forall x\in X$.
Let's proceed with this definition. For any $x \in X$ we have:
$$((f \circ g) \circ h)(x) = (f \circ g)(h(x)) = f(g(h(x))) = f((g \circ h)(x)) = (f \circ (g \circ h))(x)$$
Hence, $(f \circ g) \circ h = f \circ (g \circ h)$.