If $A$ is a field and $M$ has dimension $d$ its endomorphisms "are" $d\times d$ matrices with coefficients in $A$. This is a vector space of dimension $d^2$ over $A$ and since powers of $\phi$ are endomorphisms, only $d^2$ of them can be linearly independent, which gives you a linear relation between powers of $\phi$ such as that you wrote, taking e.g. $n=d^2+1$.
I guess that what Atiyah-Macdonald prove in their book is that the characteristic polynomial $\det(I-t\phi)$ is a particular such linear relation - the Cayley-Hamilton theorem. This polynomial is very useful to obtain information on $\phi$ and to relate linear algebra and polynomials in interesting ways. And this proof result holds for $A$ an arbitrary commutative ring. Commutative rings have the invariant basis number property but I think this does not imply that linearly independent sets in finitely generated modules cannot have infinite cardinality. So you cannot get a linear relation as for a field, where linearly independent sets have a maximal cardinality. So you are limited to the Cayley-Hamilton construction for an annihilator of $\phi$. But for most commutative rings you should have finiteness of linearly independent sets in f.g. modules, which implies linear relations between powers of endomorphisms.
Another remark: if $A$ is a field, $A[t]$ is a PID and since in general the linear relations between powers of $\phi$ form an ideal, there is a single polynomial, the minimal polynomial of $\phi$, generating all such linear relations.