Create a new module.
In this module create a Block Class which extends
Magento\Checkout\Block\Success
add this Magento\Sales\Model\Order as an injection to your block constructor.
create a function for the data you need.
Add a di.xml and in this add a preference:
<preference for="Magento\Checkout\Block\Success" type="Vendor\ModuleName\Block\YourFileName"/>
Create a layout file in Vendor/ModuleName/view/frontend/layout/checkout_onepage_success.xml with this content.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Checkout\Block\Onepage\Success" name="checkout.success" template="Vendor_ModuleName::success.phtml" cacheable="false"/>
</referenceContainer>
</body>
</page>
Copy the file [magenot_root]/vendor/magento/module-checkout/view/frontend/templates/success.phtml to your module/frontend/templates/
and edit this success.phtml as you desire.
Hope this helps.