@faizanshukoor don’t post any more code like that, read the guidelines.
You have set pins 7 and 8. I’m guessing that is your bug.
Maybe D7 and D8 or the better approach 13 and 15 which are the true GPIO references for D7 and D8.
I don’t have any nodemcu’s so I’m guessing here but incorrect pin allocation is common, especially from users that are transitioning from Arduinos.