If a structure is generated by a Set $S$, then every homomorphism is determined by its value on $S$ Let $\scr A$ be a structure generated by $S$, then every homomorphism $\pi: \scr A \to \scr{B}$ is determined by its value on $S$.
Proof:
Let $\pi '$ be another homomorphism, then $C=\{b: \pi (b)= \pi '(b) \}$ is either empty or a substructure. If $\pi$ and $\pi'$ coincide on $S$, then $S\subseteq C$ and hence $C=A$.
I am not sure I see that $C$ is a substructure, if it's not empty?
The rest I understand, if $\pi=\pi '$ for each $s$ in $S$, then $S$ is a subset of $C$ since the two functions are homomorphisms.
[It also follows that $C\subseteq S$. So, $C=A$.] This is wrong, as Mr. Alex Kruckman pointed out
Since $S\subseteq C$ and $\scr A$ is generated by $S$, then $A$ must be $C$;
 A: Let $C = \{b : \pi(b) = \pi'(b)\}$ where $\pi, \pi' : \mathcal{A} \to \mathcal{B}$ are two homomorphisms betweeen structures $\mathcal{A}$ and $\mathcal{B}$ (over some signature $\Sigma$). Then $C$ is either empty or a substructure of $\mathcal{A}$, because if $c_1, \ldots, c_n \in C$ then so is $f(c_1, \ldots, c_n)$ for any $n$-ary function symbol $f$ in $\Sigma$. (It follows as you state in the question that if $\pi$ and $\pi'$ agree on a set $S$ of generators for $\mathcal{A}$, then $\pi = \pi'$.)
A few comments are in order:

*

*Treating the case when $C$ is empty as a special case is presumably because structures are required to have non-empty universes in your context. Some authors (notably Hodges in his book Model Theory) allow structures to have empty universes.

*If the signature $\Sigma$ includes any constant symbols, then their interpretations in $\mathcal{A}$ necessarily belong to $C$ by the definition of homomorphism (so $C$ is non-empty in that case).

*If the signature $\Sigma$ has no constant symbols, then the notion of a substructure of a structure generated by $S$ is undefined (in general) if $S = \emptyset$ (unless you allow empty universes).

