How to show the view more on my display of pages shortcode

got it working now…
I added a counter

$i = 0;    
$childnum = count($children);

just after the if statement of the children. & added this code

      if ($i == $childnum - 1) {
          $output .= '<div class="viewmore">'. $viewmore .'</div>';
      }
      $i++;

after the the code:

$output .= '<div style="clear:both;"></div></div>';

…Thanks again.. 🙂