I try to show this,
suppose $R$ be a commutative ring with $1$ and $A$ be an ideal in $R$. Show if $A_{M}=0$ for all maximal ideal $M$, then $A=0$.
My idea this,
If $a\in A$ then for every maximal ideal $M$, $a\in A_{M}=0$ because $A\subseteq A_{M}$. So $a=0$.
Is it true?
No, it isn't true. In general $A$ is not a subring of its rings of fractions. There is a natural homomorphism $A\to S^{-1}A$ given by $a\to\frac{a}{1}$, but in general it isn't injective. So $\frac{a}{1}=\frac{0}{1}$ in $A_m$ doesn't imply $a=0$ in $A$. By definition it only implies there is some $s\notin m$ such that $as=0$. Moreover, if your proof was correct then we wouldn't need to assume $A_m=0$ for all maximal ideals, but just for one such ideal.
To prove your statement, let $x\in A$, and we'll show that $x=0$. Define:
$I=\{a\in A: ax=0\}$
This is clearly an ideal of $A$. If we can show that $I=A$ then we are done. (because then in particular $1\in I$, and so $x=0$). So assume $I$ is a proper ideal. Then it is contained in some maximal ideal $m$. By assumption, $\frac{a}{1}=\frac{0}{1}$ in $A_m$, and so by definition there is some $s\in A\setminus m$ such that $as=0$. But then $s\in I\subseteq m$, a contradiction.