Many Fast and Worship at Night but Earn Nothing
Abu Hurairah (radiyallahu anhu) relates that Rsulullah (sallallahu alaihi wasallam) said: “Many are the ones who fast, attaining nothing by such fasting except hunger, and many are the ones performing salaat by night attaining nothing by it, except the discomfort of staying awake at night.”
With regard to this Hadith, the Ulama have mentioned three different interpretations: Firstly this Hadith may refer to those who fast during the day and then eat iftaar with such food which is haraam (Forbidden). All the reward received as a result of fasting is destroyed because of the great sin of eating haraam. Secondly, our Nabi (sallallahu alaihi wasallam) may have meant those who fasted properly but during fasting, kept themselves busy with backbiting and slandering others. Thirdly, the person referred to may be him, who while fasting, did not stay away from evil and sin. Here all forms of sins are included. Likewise is the case of him performing salaat all night voluntarily. He may have stood in salaat all night but because of backbiting or any other sinful act (e.g. allowing Fajr salaat to pass by) his noble act becomes unrewarded.
Source: Fazail e Amal