Rewrite your code like this condition. This will display the code as you expected.
<!-- Related Posts START-->
<?php
$query = get_max_related_posts();
if ( $query ) {
$i=1;
?>
<div class="td_block_wrap td_block_7 td_block_widget td_uid_3_5de39f94df644_rand td-pb-border-top td_block_template_1">
<h4 class="block-title">
<span class="td-pulldown-size">Berita Terkait</span>
</h4>
<div class="td_block_inner">
<?php while ( $query->have_posts() ) { $query->the_post();
if($i%2!=0){?>
<div class="td-block-row"><?php
}?>
<div class="td-block-span6">
<div class="td_module_6 td_module_wrap td-animation-stack">
<div class="td-module-thumb">
<a href="https://wordpress.stackexchange.com/questions/353805/<?php the_permalink(); ?>" rel="bookmark" class="td-image-wrap" title="<?php the_title(); ?>">
<?php the_post_thumbnail(array(100,75) ); ?>
</a>
</div>
<div class="item-details">
<h3 class="entry-title td-module-title">
<a href="https://wordpress.stackexchange.com/questions/353805/<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>" ><?php the_title(); ?></a>
</h3>
</div>
</div>
</div><?php
if($i%2==0){ ?>
</div><?php
}
$i++;
} wp_reset_postdata(); ?>
</div>
</div>
<?php } ?>
<!-- Related Posts END -->