Jabir (May Allah be pleased with him) reported:
The tribe Banu Salimah wanted to move nearer to the mosque. On learning this Messenger of Allah (ﷺ) said to them, "I heard that you intend to move nearer to the mosque". They said, "That is so, O Messenger of Allah, we do want to do that". He said, "O Banu Salimah, keep to your homes, your steps (to the mosque) are recorded".[Muslim].Another narration says: "There is for every step (towards the mosque) a degree (of reward) for you".[Muslim].
Arabic/English book reference: Book 1, Hadith 136