You can add comment and status to order.
Get order :
$orderid = 12345;
$order = Mage::getModel('sales/order')->load($orderid);
And add comment:
//$isNotify means you want to notify customer or not.
$order->addStatusToHistory($status, $message, $isNotify);
$order->save()