Try this I have recorrected your code, if you have successfully retrieved those two variables
$string = '';
$h_query = new WP_Query( $args );
if( $h_query->have_posts() ){
$string .= '<div class="main_history">';
while( $h_query->have_posts() ){
$h_query->the_post();
$h_button_field = get_field('history_button_title'); // used to display the custom field
if( !empty($h_button_field) ): endif;
$h_link = get_field('history_button_url'); // used to display the custom field
if( $h_link ): endif;
$string .= '<div class="col-sm-6">' . '<div class="single_history_img">' . get_the_post_thumbnail() . '</div>' . '</div>' . '<div class="col-sm-6">' . '<div class="single_history_content">' . '<div class="head_title">' . '<h2>' . get_the_title() . '</h2>' . '</div>' . '<p>' . get_the_content() . '</p>' . '<a href="'.$h_link.'" class="btn btn-lg">' . $h_button_field . '</a>' . '</div>' . '</div>';
}
$string .= '</div>';
}
wp_reset_postdata();
return $string;
}