(8) The Book of the Masjids
كتاب المساجد
(14) Chapter: The Virtue Of Going To The Masjid
(14) باب الْفَضْلِ فِي إِتْيَانِ الْمَسَاجِدِ
Sunan an-Nasa'i 705 
It was narrated from Abu Hurairah that the Prophet (ﷺ) said:
"When a man goes out of his house to his Masjid, one foot records a good deed and the other erases a bad deed."
أَخْبَرَنَا عَمْرُو بْنُ عَلِيٍّ، قَالَ حَدَّثَنَا يَحْيَى، قَالَ حَدَّثَنَا ابْنُ أَبِي ذِئْبٍ، قَالَ حَدَّثَنَا الأَسْوَدُ بْنُ الْعَلاَءِ بْنِ جَارِيَةَ الثَّقَفِيُّ، عَنْ أَبِي سَلَمَةَ، - هُوَ ابْنُ عَبْدِ الرَّحْمَنِ - عَنْ أَبِي هُرَيْرَةَ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏ "‏ حِينَ يَخْرُجُ الرَّجُلُ مِنْ بَيْتِهِ إِلَى مَسْجِدِهِ فَرِجْلٌ تُكْتَبُ حَسَنَةً وَرِجْلٌ تَمْحُو سَيِّئَةً ‏"‏ ‏.‏
Grade :  Sahih (Darussalam)
Reference : Sunan an-Nasa'i 705
In-book reference : Book 8, Hadith 18
English translation : Vol. 1, Book 8, Hadith 706