How to display Common posts from specific Tag & Category with Shortcode

function common_cats($att){
 $args = array(
        'category__and' => $att['category'], //must use category id
        'tag__in' => $att['tag'], //must use tag id for this field
        'posts_per_page' => $att['posts_per_page']); //get all posts
        $posts = get_posts($args);
        $output = "<ul>";
        foreach ($posts as $post) :
           $output .= "<li>".get_the_title(). "</li>";
        endforeach;
        $output .= "</ul>"; 
return $output;
}
add_shortcode('commoncats', 'common_cats');

use [commoncats] where you like to show the output of the above code.
above code will return a list of titles.