php code for outputting a custom page in my account

Check this one:

How to add a new endpoint in woocommerce

Update

In your callback function include your extended template page because output is expected.

ex:

function foren_content() {
    include('woocommerce/myaccount/custom-page.php');
}

Then inside custom-page.php call the desired content with get_post(ID) or if you have your endpoint registerd in woocommerce settings call it by slug.

The whole process of adding new endpoints is explained in this article with a great example using a class.

https://stackoverflow.com/questions/38039616/woocommerce-assigning-an-endpoint-to-a-custom-template-in-my-account-pages

Personally i would use the class shown in the article because it executes all necessary procedures and you have all the code in one place. I could elaborate on this here but is already explained in posted article.

Depends on the approach and version of woocommerce. The easiest way is to continue current approach. I think your question is a matter of stackoverflow. 🙂

Hope it helps.
Regards