Use of a NodeMCU as a WiFi modem is unusual, but not impossible.
The main thing ids to ensure that it’s running AT firmware. A fresh NodeMCU may be loaded with AT firmware from the factory, but if you’ve ever uploaded a sketch to it then the AT firmware will have been overwritten.
Most people use an ESP-01 rather than a NodeMCU, but the basic principles are the same.
I’d start by considering using an ESP32 instead of the Mega.
If that won’t work for you then read this…
You could also consider Blynk.NCP with your Mega/NodeMCU.
In addition, your code is very badly written and your void loop isn’t compatible with Blynk.
You should read this…
Pete.