So as @shanebp suggested you have to use tax_query it would also help if you use operator in tax_query.
following is your code after make some minor changes;
<ul class="products-newo">
<?php
$attributes = $product->get_attributes();
$pa_brand = $attributes["pa_brand"];
$args = array(
'post_type' => 'product',
'posts_per_page' => 4,
'tax_query' => array( array(
'taxonomy' => 'pa_brand',
'field' => 'slug',
'terms' => $pa_brand->get_slugs(),
'operator' => 'IN',
) )
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
} else {
echo __( 'No products found' );
}
wp_reset_postdata();
?>
</ul>
But i also want to suggest if you check a small condition just after the $attributes = $product->get_attributes(); line.
if( isset($attributes["pa_brand"]) )
Otherwise if any product does not have this value you will get error.
Thank you.