It doesn’t look like Shopify Functions provides the functionality to directly modify line items within the cart. The cart is part of the client-side storefront, and Shopify Functions operates on the server side. A better approach might be to use Shopify’s Storefront API (which all apps now have access to) or AJAX API on the client-side. These APIs let you interact with cart contents before the order is placed, allowing you to add or modify line item properties.
Hope this helps - take a look at the Storefront API and if you’re still having issues reply here and we look into this further!