While loop inside void loop() causing problems

But why is the device getting s WDT reset?

Because you spend too much time in loop()

The purpose of watchdog timer (WDT) is to recover program when loop() hangs out for more than.. 8sec I think.

You should either change code to return from loop() quickly, by preserving status in global variables, or disable WDT which is not recommended