You don't need a while loop, the OnLoop is basicly your while loop
Try this:
if (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.PENDING_BUY) {
status = "Pending offer";
}else if (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.FINISHED_BUY) {
status = "Offer completed - Collecting";
}