It is easy to show that $e \in T$ (since $e \ast e = e$) and that $e$ acts as a unit element. Furthermore, $T$ contains inverses of its elements. By definition, the operation $\ast$ is associative. The most tricky part is showing that $T$ is closed under $\ast$. Suppose that $a$, $b \in T$. Then we have to show that $a \ast b$ is in $T$ as well, thus we have to show that there exists $c,d \in T$ such that $a \ast b \ast c = e$ and $d \ast a \ast b = e$. We know that there is an $x \in T$ such that $b \ast x = e$ and that there is a $y \in T$ such that $a \ast y = e$. Then we have $a \ast b \ast (x \ast y) = e$, so we can take $c = x \ast y$. Analogously, we can find a suitable choice for $d$. (Note that it is not required that $x \ast y$ is itself in $T$, only that it is in $S$.)
Edit:
Why is $e$ in $T$? Because there exist $y,z \in S$ such that $y \ast e = e = e \ast z$. One can take $y=z=e$ since $e \ast e = e$ (applying $e \times x = x$ with $x = e$).
Why contains $T$ inverses of its elements? Suppose $a \in T$. Then there are $b,c \in S$ with $a \ast b = e$ and $c \ast a = e$. This means that $c = c \ast e = c \ast (a \ast b) = c \ast a \ast b = (c \ast a) \ast b = e \ast b = b$, hence $b = c$. So we have $a \ast b = e$ and $b \ast a = e$. Note that this implies that $b \in T$, and therefore $b$ is an inverse of $a$.