I have custom collection in $collection I want to pass it to list.phtml so that I don't have to create listing UI again. I am trying to do this but it is not working
<?php
echo $this->getLayout()
->createBlock("Magento\Catalog\Block\Product\ListProduct")
->setProductCollection($collection)
->setTemplate("Magento_Catalog::product/list.phtml")
->toHtml();
?>