So the While loop checks for no connection and flashes the leds and prints ';' Is that where it gets to ? Meaning you have no connection ?
Is it printing the ssid etc. If not I suggest you check your ssid and password are correct including caps letters etc.
And please put your code in tags as per sticky at top of forum " How to post ....."
So it prints "Connecting to " but not the ssid ? Which at that point is just a char string. Odd.
If the leds are flahing at 1 sec intervals and it keeps printing ";" every few seconds to the monitor it means you have no connection. This is what the While loop is testing.
Maybe someone else can see something blindingly obvious I'm missing.
Unfortunately I can't get to my spare NodeMCU to test the code and I'm not taking my own working one offline.
In the first code you are printing ....... till a connection is made. Try not flashing the leds and doing the same .... till conection as a test.
Glad to have helped and it's sorted.