كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(50)
Chapter: The virtue of taking many steps to the masjid
(50)
باب فَضْلِ كَثْرَةِ الْخُطَا إِلَى الْمَسَاجِدِ ‏
Sahih Muslim 665 b

Jabir b. Abdullah reported that Banu Salama decided to shift near the mosque (as there were) some plots vacant. This (news) reached the Messenger of Allah (ﷺ), whereupon he said:

O people of the Salama tribe, you better stay in your houses (where you are living), for your footsteps are recorded They said. We could not be more delighted even by shifting (near the mosque) as we were delighted (on hearing these words from the Messenger of Allah (ﷺ).
حَدَّثَنَا عَاصِمُ بْنُ النَّضْرِ التَّيْمِيُّ، حَدَّثَنَا مُعْتَمِرٌ، قَالَ سَمِعْتُ كَهْمَسًا، يُحَدِّثُ عَنْ أَبِي نَضْرَةَ، عَنْ جَابِرِ بْنِ عَبْدِ اللَّهِ، قَالَ أَرَادَ بَنُو سَلِمَةَ أَنْ يَتَحَوَّلُوا، إِلَى قُرْبِ الْمَسْجِدِ ‏.‏ - قَالَ - وَالْبِقَاعُ خَالِيَةٌ فَبَلَغَ ذَلِكَ النَّبِيَّ صلى الله عليه وسلم فَقَالَ ‏ "‏ يَا بَنِي سَلِمَةَ دِيَارَكُمْ تُكْتَبْ آثَارُكُمْ ‏"‏ ‏.‏ فَقَالُوا مَا كَانَ يَسُرُّنَا أَنَّا كُنَّا تَحَوَّلْنَا ‏.‏
Reference : Sahih Muslim 665b
In-book reference : Book 5, Hadith 353
USC-MSA web (English) reference : Book 4, Hadith 1408
  (deprecated numbering scheme)