In Exercise 3.15 in Atiyah and Macdonald's Introduction to Commutative Algebra, the ring $R$ can be assumed to be a local ring, because of proposition 3.9.
That proposition states that if $\phi: M \rightarrow N$ is a $R$-module homomorphism, then the following are equivalent:
i) $\phi$ is injective.
ii) $\phi_{\mathfrak p}: M_{\mathfrak p} \rightarrow N_{\mathfrak p}$ is injective for each prime ideal $\mathfrak p$.
iii) $\phi_{\mathfrak m}: M_{\mathfrak m} \rightarrow N_{\mathfrak m}$ is injective for each maximal ideal $\mathfrak m$.
I am not sure what does $M_{\mathfrak m}$ mean, and is still searching for it. Also sorry for quoting a link without carefully reading the paragraph.
From the comments under the question:
In that exercise you have an $A$-module homomorphism $\phi:F\to F$ ($F$ is a free $A$-module of rank $n$) which is surjective and want to show that it is injective. Then, by Proposition 3.9, it's enough to show that $\phi_{\mathfrak p}:F_{\mathfrak p}\to F_{\mathfrak p}$ is injective for every prime ideal $\mathfrak p$ of $A$. But $F_{\mathfrak p}$ is a free $A_{\mathfrak p}$-module of rank $n$ (why?), and thus one may replace $A$ by $A_{\mathfrak p}$ which is local.
Btw, $M_{\mathfrak m}$ stands for the localization of $M$ at the maximal ideal $\mathfrak m$.