magento2 – Magento custom PHTML correct way to snip in the code

Hi all I have a script need to snip in to the custom.phtml
How do I snip it in correctly?

such as I have to remove html and body tags. How about the include jquery thing?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>

I need to remove it as well right or have some other replacement?

<html>
    <body>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
        <script id="mediaTemplate" type="text/x-jsrender">
    <div class="candid-wall-cell">
        <div class="candid-wall-overlay">
        </div>
        <div class="candid-wall-overlay-text">
            <i class="candid-icon candid-fa-{{> Media.Source.toLowerCase() }}"></i>
            <div>SHOP NOW</div>
        </div>
        <a class='media' data-media-index='{{> Index }}'>
            <img data-original="{{> Media.Images.LowResolution.Url }}" 
                 alt="{{> Title }}" 
                 style="display:inline-block;"
                 class="lazy">
        </a>
    </div>
</script>
        <script type="text/javascript" 
                src="https://api.getcandid.com/scripts/widget.js">
        </script>
        <script type="text/javascript">
            candid.wall('#container', { 
                id: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
                cluster: 'prod-2',
                layoutMode: 'masonry',
                layout: 'standard',
            });
        </script>
        <div id="container"></div>
    </body>
</html>