It is narrated from Sayyiduna Abdullah bin Amr (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: "Whoever walks to the mosque for congregational prayer, one step erases a sin and one step records a good deed, both going and returning."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 13696