Why is this part of your code inside the for() loop?
WiFi.disconnect(); // Disconnect WiFi.
newWiFi = true; // Set flag to say we are listening for new WiFi credentials.
WiFi.listen(); // Listen for new WiFi credentials.
Web IDE does not prevent you from receiving the serial output. You can use any terminal program on your computer to catch the output.
You can also use particle serial monitor --follow for that purpose.