you need to use get_sub_field rather than the_sub_field. The first returns the values the second echoes the value, I also added the missing ‘h’ to the closing tag
while ( have_rows('page_layout') ) : the_row();
if( get_row_layout() == 'heading_text' ):
$headingLevel = get_sub_field('heading_level');
echo '<h' .
$headingLevel .
'>Another variable here with heading content</h' .
$headingLevel . '>';