You can either put some kind of javascript in your output that removes the "pls wait" line, or you can use CSS to place the "status:" line on top of the other, obscuring the old message. You might need to disable output buffering (
$|=1). Ofcourse, you could also have the page reload once a second until the code is done, but that requires a bit more coordination.
On an unrelated note: why are you exit()ing with the STDOUT output of sudo as the status code? And you should probably use taint mode.