I am enclosing bash -x output which shows that the command "sudo iwlist wlan0 scan" was executed and returned expected text to terminal . The issue is - this text was not passed to whiptail msgbox option.
This fails with other "sudo ... " commands, and only with "sudo .. commands. My guess is there are non printing characters in the output text causing this issue.
sudo iwlist wlan0 scan wlan0 Interface doesn't support scanning : Network is down whiptail --title 'Command sudo iwlist wlan0 scan output 1400' - -separate-output --scrolltext --msgbox '' 17 80 10