only delete post within query / for each statement (front end)

You should pass in the id of the post you want to delete as an argument of the delete_post() function rather than relying on obtaining it via global $post within the function itself:

<?php echo delete_post($section->ID); ?>

Then in your delete_post() function you can use the passed-in argument like so:

function delete_post($sectionid){
    $deletepostlink= add_query_arg( 'frontend', 'true',   get_delete_post_link( $sectionid ) );
    if (current_user_can('edit_post', $sectionid)) {
        echo '<span><a class="post-delete-link" onclick="return confirm(\'Are you sure to delete?\')" href="' . $deletepostlink . '">Delete  this </a></span>';
    }
}