I'm going to use the terminology "manifold" instead of "surface", because "surface" usually means 2-dimensional.
Let me use the notation $M$ for the manifold in question.
You have to somehow make use of the hypothesis that the manifold $M$ is connected. Since manifolds are locally path connected, you can use the theorem that a connected, locally path connected space is path connected.
Consider the common chart $\varphi_1 : U_1 \to \mathbb R^k$ in $A_1 \cap A_2$, and fix a base point $p \in U_1$.
Now I'll prove directly that any chart in $A_1$ and any chart in $A_2$ are consistent at any point of their overlap.
Consider any $x \in M$, and pick charts $\phi_I : U_I \to \mathbb R^k$ in $A_1$ and $\varphi'_J : U'_J \to \mathbb R^k$ in $A_2$, such that $x \in U_I \cap U'_J$. We have to show that $\varphi_I$ and $\varphi'_J$ are consistent at the point $x$.
Using path connectivity of the manifold $M$, choose a continuous path $\gamma : [0,1]$ such that $\gamma(0)=p$ and $\gamma(1)=x$. Since the sets $\{U_i \cap U'_j\}_{i,j}$ cover $M$, their inverse images $\{\gamma^{-1}(U_i \cap U'_j)\}_{i,j}$ cover $[0,1]$. Applying the Lebesgue Number Lemma, we can choose an integer $N \ge 1$, and decompose $[0,1]$ into subintervals $I_m = [\frac{m-1}{N},\frac{m}{N}]$, $m=1,\ldots,N$, so that $\gamma(I_m)$ is a subset of one of the intersections $U_{i(m)} \cap U'_{j(m)}$.
We know that $\varphi_{i(1)}$ and $\varphi'_{j(1)}$ are both consistent with each other at $\gamma(0)=p$, because both are consistent with $\varphi_1$. Consider the path $\gamma \mid I_1$ and let $t \in I_1 = [0,1/N]$ vary from $0$ to $1/N$. As $t$ varies, the determinant of the derivative of the overlap map of the two charts $\varphi_{i(1)}$ and $\varphi'_{j(1)}$ varies continuously, it is nonzero everywhere, and it is positive at $t=0$, hence it is positive at $t=1/N$. This proves that $\varphi_{i(1)}$ and $\varphi'_{j(1)}$ are consistent at $\gamma(1/N)$.
Now we do an induction proof: assuming by induction that $\varphi_{i(m)}$ and $\varphi'_{j(m)}$ are consistent at $\gamma(m/N)$, we prove that $\varphi_{i(m+1)}$ and $\varphi'_{j(m+1)}$ are consistent at $\gamma((m+1)/N)$. Since $\varphi_{i(m)}$ and $\varphi_{i(m+1)}$ are consistent at $\gamma(m/N)$, and since $\varphi'_{j(m)}$ and $\varphi'_{j(m+1)}$ are consistent at $\gamma(m/N)$, it follows that $\varphi_{i(m+1)}$ and $\varphi'_{j(m+1)}$ are consistent at $\gamma(m/N)$. Now the proof continues as in the previous paragraph, using continuity of the determinant of the derivative of the overlap map of the two charts $\varphi_{i(m+1)}$ and $\varphi'_{j(m+1)}$ at $\gamma(t)$, as $t \in I_{m+1}$ varies from $m/N$ to $(m+1)/N$, and the consistency of those charts at $\gamma(m/N)$, to deduce consistency at $\gamma((m+1)/N)$. This completes the induction step.
To complete the proof, we have shown that $\varphi_{i(N)}$ and $\varphi'_{j(N)}$ are consistent at $\gamma(N/N)=x$. We also know that $\varphi_I$ is consistent with $\varphi_{i(N)}$, and $\varphi'_J$ is consistent with $\varphi'_{j(N)}$ at $x$. Therefore, $\varphi_I$ and $\varphi'_J$ are consistent at $x$.