Below is the proof I took from textbook A Course in Mathematical Analysis by Proof D. J. H. Garling.
I think there are some typos, which I highlighted in the attached picture.
- $g(s(n))= f(n)$
Since the theorem states $a_{s(n)}=f(a_{n})$, I think the right version should be: $g(s(n))=f(g(n))$, not $g(s(n))= f(n)$.
2.$(n,a)\in P$ and $(n,a')\in P$
I think the right version should be: $(n,a)\in g$ and $(n,a')\in g$
3.$(s(m),f(b))\in g$
Since the author is trying to prove $g'\in S$, I think the right version should be: $(s(m),f(b))\in g'$, not $(s(m),f(b))\in g$.
4.$(s(m),f(b))\notin g$
As in 3., I think the right version should be: $(s(m),f(b))\notin g'$, not $(s(m),f(b))\notin g$.
Please check whether I am right or wrong about these typos!

Ad 1. Indeed, $n\in P$, not $n\in A$, hence $f(n)$ would not even make sense. But the correct formula should be $$ g(s(n))=f(g(n)).$$It is only after finding this nice $g$ that we can set $a_n=g(n)$ an have our recursively defined sequence.
Ad 2. Yes. Again, $\in P$ would not even make sense. If you follow the argument, you will notice that $\in g$ is used and shown, so at least the typo is no show-stopper for the proof.
Ad 3 and 4. No and then Yes. That step of the argument should read
There seem to be more typos, e.g., there is a superfluous $S$ in what should read