It is narrated from Hazrat Uqbah bin Amir (may Allah be pleased with him) that I heard the Prophet (peace and blessings be upon him) say: When a person performs ablution and comes to the mosque with the intention of prayer, then for every step he takes towards the mosque, Allah writes ten good deeds for him in exchange for each step, and when he prays in the mosque and then sits there, he is like one who is fasting and devoutly worshipping, until he returns.
Hadith Referenceمسند احمد / مسند الشاميين / 17456
Hadith Gradingحکم دارالسلام:حديث صحيح، وهذا إسناد ضعيف، ابن لهيعة سيئ الحفظ