Q:

What are the disadvantages of using global variable? 

I am a newbie at WordPress.  In my "recent posts" shortcode, I used global $post variable, because the_title() function was giving me page's title, not post's title.  I am not exactly sure, but I thought that's because of loop inside of a loop.  
Some advanced users here tell me not to use global variable, so using global $post variable inside my "recent posts" shortcode is good or not? 

A:

The global variable $post will be set to the first post in the main query.  When any Loop runs (assuming it is constructed correctly), whether the main Loop or any number of secondary ones, $post will be set to each post in that/those loops in turn.  At the end of the Loop, it will be set to the the last post in the last Loop that ran.  The functions wp_reset_query and wp_rest_postdata help clear this up in a lot of cases. 
I am pretty sure that the problem is the construction of your "loop inside of a loop" but you don't post the code so guessing is all I can do.  My guess is that you have something like:
$recent = get_posts(/*...*/);
foreach ($recent as $r) {
  the_title();
}

And you need:
$recent = new WP_Query(/*...*/);
if ($recent->have_posts()) {
  while($recent->have_posts()) {
    $recent->the_post();
    the_title();
  }
}
wp_reset_postdata();

