Thumma marks the next stage. Yakhruju is an imperfect verb with the pilgrim as its understood subject. Ilā al-Ṣafā is a prepositional phrase indicating destination.
In fa-yaṣʿadu ʿalayhi, the prefix links the next action and the pronoun refers to Safa. Bi-ḥājatihi expresses the need being presented in supplication.