To add a new attribute to your anchor link for the nav items concatenate $attribute variable with your required attribute. You have commended code just uncomment the code and use those
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_atta( $item->attr_title ) .'"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_atto( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' itemprop="' . esc_attr( $item->url ) .'"' : '';
//$atts = array();
//$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
//$atts['target'] = ! empty( $item->target ) ? $item->target : '';
//$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
//$atts['href'] = ! empty( $item->url ) ? $item->url : '';
Hope this works for you.