Given a magma $(M, \ast)$, $(a \ast a')$ is cancellative, iff
$$\forall b,c \in M. b \ast (a \ast a') = c \ast (a \ast a')\Leftrightarrow b = c$$
The magma has an identity, iff: $$\exists e.\forall a \in M. a \ast e = a = a \ast e$$
Now if we use the first formula, and use $e$ for b and c, we get: $$e \ast (a \ast a') = e \ast (a \ast a')\Leftrightarrow e = (a \ast a')$$
Is this correct?
No: you have substituted $a*a'$ instead of $e$ for $c$ in the final part. The correct statement is $$e \ast (a \ast a') = e \ast (a \ast a')\Leftrightarrow e = e.$$ This is true, but not interesting (both sides of the $\Leftrightarrow$ are obviously true).
Indeed, your statement is typically false: for instance, the magma $(\mathbb{N},+)$ has an identity and every element is cancellative, but not every element is equal to the identity.