Sunan an-Nasa'i, Book 8, Hadith 18 (Nasa'i 707)

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."