After seeing your other question, I think I finally understand what you’re looking for.
You need to create an acf/save_post filter https://www.advancedcustomfields.com/resources/acf-save_post/ with a priority >10. In your filter you can get the values from the ACF fields and save them to the content using the code from the OP.