Retrieving posts by their date and category

Please try the following code:

Following code has to be added in shortcode function

 global $wpdb;
    $start .= $attr['godina'] . "-09-01";
    $end .= $attr['godina'] + 1 . "-08-31";
    $cat = $attr['cat']; //$cat must be category name.
    $cat_term_id=get_term_by('name', $cat, 'category');
    $term_id=$cat_term_id->term_id;
    $query = array(
      'post_type' => 'post', 
      'tax_query' => array(array( 'taxonomy' => 'category',
                               'field' => 'term_id',
                               'terms'=>$term_id
                               )),

      'post_status' => 'publish',

      'date_query'     => array(
                                array(
                                    'after'     => $start,
                                     'before'    => $end,
                                     'inclusive' => true,
                               )
                        )
    );

$query_str = new WP_Query( $query );