[guided]The important point is that a quantifier-free sentence can only talk about closed terms: terms built from constant symbols and function symbols, with no variables. These closed terms are already interpreted inside any $L$-substructure.
By assumption, there are $L$-substructures $A_M \subseteq M$ and $A_N \subseteq N$ together with an $L$-isomorphism
\begin{align*}
f: A_M &\to A_N.
\end{align*}
Because $A_M$ is an $L$-substructure of $M$, it contains the interpretation of every constant symbol and is closed under every function symbol of $L$. Therefore every closed $L$-term $t$ has its value $t^M$ inside $A_M$. Similarly, $t^N \in A_N$.
We now check that $f$ sends the value of each closed term in $M$ to the value of the same term in $N$. This is proved by induction on the construction of $t$. For a constant symbol $c$, preservation of constants by an $L$-isomorphism gives $f(c^M)=c^N$. If
\begin{align*}
t = g(t_1,\dots,t_m)
\end{align*}
for an $m$-ary function symbol $g$ and closed terms $t_1,\dots,t_m$, then the induction hypothesis gives $f(t_i^M)=t_i^N$ for each $i$. Since $f$ preserves the function symbol $g$,
\begin{align*}
f(t^M)
&= f(g^M(t_1^M,\dots,t_m^M)) \\
&= g^N(f(t_1^M),\dots,f(t_m^M)) \\
&= g^N(t_1^N,\dots,t_m^N) \\
&= t^N.
\end{align*}
Now consider atomic sentences. For equality, the injectivity of $f$ gives
\begin{align*}
M \models t_1 = t_2
&\iff t_1^M = t_2^M \\
&\iff f(t_1^M) = f(t_2^M) \\
&\iff t_1^N = t_2^N \\
&\iff N \models t_1 = t_2.
\end{align*}
For a relation symbol $R$ of arity $k$, preservation and reflection of relations by the $L$-isomorphism gives
\begin{align*}
M \models R(t_1,\dots,t_k)
&\iff (t_1^M,\dots,t_k^M) \in R^{A_M} \\
&\iff (f(t_1^M),\dots,f(t_k^M)) \in R^{A_N} \\
&\iff (t_1^N,\dots,t_k^N) \in R^{A_N} \\
&\iff N \models R(t_1,\dots,t_k).
\end{align*}
Thus $M$ and $N$ agree on every atomic $L$-sentence.[/guided]