Is it possible to update the dataset using update_post_meta

You don’t need your second foreach loop.

foreach( $_POST['wt_set'] as $name => $val ){
    update_post_meta( $post_id, $name, $val );
}

What’s happening is with your second foreach is each entry is being processed individually and set as the post meta, so as it’s looping through it’s running update_post_meta( $post_id, $name, XXX ); then update_post_meta( $post_id, $name, XXX ); which overrides the previous one.