Saving woocommerce_custom_product_text_field to DB

I found and customized function to make a custom order of products on FE by using custom meta.
We have one problem. We can see default data in BE of every product but it becomes visible on FE only after manually updating the product. We have thousands of products so it is not possible to reupdate every single product manually. Problem is that function saves data to DB only after manual update of products.
Does anybody has an idea of how to customize the function to save default data to DB by “default”? You can find our function below.