Query a custom taxonomy in a function to create an csv file

I’m fairly sure you just need to pass an array for terms like this:

$arg = array(
     'post_type' => 'certificate',
     'post_status' => 'publish',
     'posts_per_page' => -1,
     'tax_query' => array(
          array(
               'taxonomy' => 'list',
               'field'    => 'slug',
               'terms'    => array($filter)
           )
      ),
);