You have an answer to the 'example' version of your question already, but let me offer an answer to the "actual" question: if one is faced with two schemes $A$ and $B$, and for each $a\in A$ you have some way of constructing $f(a)\in B$, how might one check that $f$ is (or more precisely comes from) a morphism of schemes?

The answer, in many cases where $A$ is the solution to a moduli problem, is this. We're thinking of $A$ as parametrising objects $X$ (e.g. curves of genus $g$, elliptic curves with a point of order $n$ etc etc) and so for $a\in A$ you have some object $X_a$ corresponding to that point. You have a recipe that gives an element of $B$ (typically because $B$ is also the solution to a moduli problem) and you want to define the map $A\to B$ by following your nose.

But the insight is that the recipe you have, going from $A$ to $B$, might work in much more generality than you think. Let's take for example the map from the moduli space of elliptic curves plus points of order $n$, to the affine line, sending each elliptic curve to its $j$-invariant. This is "obviously" a continuous map $Y_1(n)\to{\mathbf{C}}$. But why is it a morphism of schemes?

[EDIT: I added the magic words "Weierstrass equation" to make this para correct] Well, if you go and read the definition of the $j$-invariant of an elliptic curve defined by a Weierstrass equation, then you see that if the coefficients of the Weierstrass equations are actually in a *ring* rather than a field, then the $j$-invariant of that curve is an element of that ring. Next one checks that $j$ is a well-defined invariant of the curve, that is, Weierstrass equations giving isomorphic curves have isomorphic $j$-invariants. **But that solves your problem at a stroke!** For say we have an $S$-valued point of $A$, for $S$ now any scheme. This corresponds to an elliptic curve over $S$. Now we can cover $S$ with affines such that on these affines the curve is defined by a Weierstrass equation. The $j$-invariant on these affines is a function on the affines, and uniqueness of $j$-invariants show that these functions glue (intersection of affines can be covered by affines---the usual trick) to get a well-defined function on the scheme $S$, that is, an $S$-valued point of the affine line. So for all $S$-valued points of $A$ we get an $S$-valued point of $B$ this way, just "following the definition" but applying it to the relative situation rather than the situation over fields. And the killer blow: now apply this to $S=A$, with the curve over $S$ equal to the universal curve over $A$. And there's your morphism.

[The above answer was initially too sloppy; thanks to Emerton and BCnrd for pointing this out below in the comments]