Shortcode syntax errors

You’re missing semicolons after </li>, </ul>, and $output. You also shouldn’t be echoing inside string concatenation and not adding the <li> tag to $output. The below is your code with these fixes.

function allphotos_shortcode(){

  $images = get_field('fl_gallery');

  if( $images ) {
      $output .= '<ul>';
      foreach( $images as $image ) :
              $output .= '<li><a href="' . $image['url'] .'"><img src="' . $image['sizes']['thumbnail'] . '" alt="' . $image['alt'] . '" /></a><p>' . $image['caption'] . '</p></li>';
         endforeach;
      $output .= '</ul>';
}

return $output;
 }

add_shortcode('allphotos', 'allphotos_shortcode');