Create shipment from script

Hi,
I’m trying to create a shipment from script but the shipment statement does not include the products line. Here’s part of my code. My question is why doesn’t the addline or create_line work?

$sh = new Expedition($db);

$sh->socid = 2;

$sh->user_author_id = 1;

$sh->user_valid = 1;

$sh->entity = 1;

$sh->ref_customer = ‘test shipment’;

$sh->date_creation = ‘2020-01-06’;

$sh->shipping_method_id = 9;

$sh_id = $sh->create($user, 0);

$sh->create_line(1, 28, 10, 0);

$sh->valid($user, 1);

$sh->add_object_linked(‘commande’, $id);

$sh->update($user, 1);