Why do you think Paulo Coelho made Santiago walk through the desert in The Alchemist?
In the story The Alchemist, by Paulo Coelho, Santiago does not walk through the desert. He and the Englishman have camels on which to travel. However, if you are asking why Coelho requires Santiago's character to cross the desert, I would say that it is because the boy still has much to learn.
By the time Santiago starts his journey across the desert, he has shown a great deal of personal growth. He is aware of the quest necessary to discover one's Personal Legend, and he is aware also of the Language of the World, that universal language in which nature speaks to us. This is not the same boy who left his sheep, was tricked into losing his money, or who met the old king.
We can see Santiago's progress as he listens to the desert; as the Englishman tries to teach him about the mythological science of alchemy (which the boy ultimately rejects as something foreign to his own Personal Legend); and, as he comes to peace with his possible death in facing the tribal leaders gathered in the tent, in order that he can speak of his vision.
However, the boy still has to meet the alchemist, and still must be tested further until he achieves his life's goals. He must face his fear of suffering. He must achieve feats of which he believes he is incapable. He also must realize with certainty the importance of pursuing his Personal Legend to its end. And while Santiago's journey will ultimately take him back to Spain ("there's no place like home..."), what he has learned along the way is as important as any physical treasure he seeks.