In Great Expectations, what is the purpose of Pip taking his namesake to the churchyard?
You are of course refering to the curious detail that we are provided with in the final chapter that is so richly reminiscent of the first chapter. Let us remind ourselves of what Pip does with his namesake:
I thought so too, and I took him out for a walk next morning, and we talked immensely, understanding one another to perfection. And I took him down to the churchyard, and set him on a certain tombstone there, and he showed me from that elevation which stone was sacred to the memory of Philip Pirrip, late of this parish, and Also Georgiana, Wife of the Above.
The echoes of Pip's first encounter with Magwitch are clear and obvious, and this repetition is mean to indicate the way in which Pip as a character has developed and matured over the intervening years. He seems to be mirroring Magwitch's actions by placing the young child on the tombstone and this could symbolise the way that he accepts now the kind of fatherly affection that Magwitch tried to offer him and that he will also offer to his namesake.
In addition, the way that he shows the younger Pip the graves of his own family indicates that the elder Pip will be a father figure to the younger Pip, just as he has had so many substitute parents feeding into his own life. However, the key difference is that Pip will be a loving, caring substitute parent with his "child's" best interests at heart rather than using this relationship for his own purposes. This ending offers us a hopeful close to the novel as we imagine the younger Pip growing with the love and counsel of an affectionate and caring godfather in the person of Pip.