Moshe Rabbeinu is told by Hashem that he is going to die, so he asks Hashem to appoint another leader so "that the congregation of Hashem should not be as a flock without a shepherd."
The Light of Holiness the Sfas Emes notes that the pasuk calls the Jews the congregation of Hashem. The purpose of the leader and tzaddik is to help the people prepare themselves for Hashem to reveal Himself. In the bitter exile He is not recognizable as the goyim say to the Jews "Ayay Elokecha" - where is your G-d?! But if we have a good leader the Jews will not be as a flock without a shepherd i.e. Hashem, because the leader will guide us to Him. That is why the Jews are called the congregation of Hashem even as Moshe is asking for a new leader because ultimately the job of this leader is to bring us to our true Leader.
It also makes sense that this request of Moshe was for all the generations. So Moshe gave smicha and his spirit to Yehoshua who then passed it on to the elders who passed it on to the prophets who passed it on to the men of the great assembly [anshei knesses hagdola] as we learn in pirkei avos. We see that Moshe's spirit is being transmitted from generation to generation. Pirkei Avos is meant to teach us the way of our forebearers whose task is to bring us to our true Guide and see His Divine providence.
That is the the meaning of what Yaakov says "Ha'avos asher hishalchoo etc. lifanav" - Our forefathers who walked before you [i.e. Hashem], and he further says "Ha'elokim haro'e osi mayodi" - Hashem who has fed me since I existed. We follow the ways of the Avos who bring us back to the true source of everything.
How the words of Dovid Hamelech shine - "Hashem ro'e lo echsar" - Hashem is my shepherd I shall not lack.
So we see that a tzaddik is not meant as a substitute for Hashem [chas vi'chalila] but a a guide to bring us close to Him.
May we all merit to cling to true tzaddikim upon whom the Infinite Light [Ohr Ein Sof] shines.
[Based on the Sfas Emes Pinchas 1888]
Love and blessings!!