I was just looking into something similar on another topic. Instead of update_sub_field() which only lets you update existing sub fields, use update_field() and pass it an array of values for the sub_fields. There is an example of adding sub fields under “Usage”
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users