ولقد جاءكم يوسف من قبل بالبينات
And indeed Yusuf came to you, in times gone by, with clear signs,
refers to the people of Egypt.
Allah sent a Messenger to them before the time of Musa, peace be upon him, in the person of Yusuf, peace be upon him, who attained a high position in the government of the people of Egypt. He was a Messenger who called his people to Allah with justice, but they did not obey him in matters of worshipping Allah, they only obeyed him in worldly matters that pertained to his position in the government.
Allah says:
فما زلتم في شك مما جاءكم به حتى إذا هلك قلتم لن يبعث الله من بعده رسوﻻ
but you ceased not to doubt in that which he brought to you, till when he died, you said: "No Messenger will Allah send after him.''
means, `you despaired, and said by way of wishful thinking,'
لن يبعث الله من بعده رسوﻻ
No Messenger will Allah send after him.
This was because of their disbelief and rejection (of the Messengers).
كذلك يضل الله من هو مسرف مرتاب
Thus Allah leaves astray him who is a transgressor and a skeptic.
means, this is the state of the one whom Allah sends astray because of his sinful actions and the doubts in his heart