You cannot know the purpose of the journey until you have completed it.
Isn’t it obvious? Say you plan a vacation to Goa with the intention of having a good time but you miss your flight and then have to hitch hike your way, wouldn’t you get new experiences on the way? When you actually complete your trip, you will realize what that trip taught you. But if you are cursing yourself for missing the flight and are complaining of all the trouble you went through, maybe you will not learn anything new. Similarly in life. Welcome everything what happens in your life.