Adding tracking information to a shipment (Magento 1)

Use the following code to add a tracking number to an existing shipment.