Add attribute taxonomy through code don’t appear in admin product page

the solution is:

foreach ($attributes as $attr => $value) {
                            $attr="pa_".$attr;
                            wp_set_object_terms($post_ID, $value, $attr);
                             $thedata[sanitize_title($attr)] = Array(
                                        'name' => wc_clean($attr),
                                        'value' => $value,
                                        'postion' => '0',
                                        'is_visible' => '1',
                                        'is_variation' => '1',
                                        'is_taxonomy' => '1'
                                );
                            }

                        update_post_meta($post_ID, '_product_attributes', $thedata);