Get WordPress Attachment PowerPoint URL in Post

I want to show the PPT file in this frame in WordPress post.

<iframe src="https://view.officeapps.live.com/op/embed.aspx?src=<?php echo $attachment_url ?>" width="100%" height="500px" frameborder="0"></iframe>

I have placed this loop in post.php. But is not working.

<?php
$args = array(
    'post_type' => 'attachment', // Retrieve attachments
    'post_mime_type' => 'application/vnd.ms-powerpoint', // Filter by MIME type for PPT files
    'posts_per_page' => -1, // Retrieve all attachments
);

$attachments = new WP_Query($args);

if ($attachments->have_posts()) :
    while ($attachments->have_posts()) : $attachments->the_post();
        $attachment_id = get_the_ID();
        $attachment_title = get_the_title();
        $attachment_url = wp_get_attachment_url($attachment_id);


    endwhile;
endif;

wp_reset_postdata(); // Restore the original post data
?>`

Someone please help us in correcting this code.