Your test.php file is a standalone script and isn’t part f WordPress so it has no access to the WordPress functions.
A simple way to resolve this would be to include wp-load.php at the top of your script, but AFAIK this is not a good approach as you’re loading WordPress over again to use just a single function.
In your public_html folder
<?php
require_once('wp-load.php');
wp_mail('[email protected]','test','hi');
?>