PHP variable not regenerating when publishing multiple posts at the same time

You don’t need a save_post hook.

When you call wp_insert_post, it will return either a post ID or an error object. We can use this to then assign the category by taking categ from $result.

I imagine it would looks similar to this:

$post_id = wp_insert_post( $abstract_details );
if ( ! is_wp_error( $post_id ) ) {
    wp_set_object_terms( $post_id, $result['categ'], 'category' );
}

You could also use the post_category parameter of wp_insert_post or the tax_input parameter.