You can follow the instructions shown here, https://www.joomlashack.com/blog/joomla/remove-links-from-login/ that shows you how to remove it from the Login form displays, which is not exactly the page you want to hide it on however it does show you the technique. This other link tells you a bit more about your specific requirement, https://forum.joomla.org/viewtopic.php?t=962895
There are numerous other examples for how to do this if you search for 'joomla hide password reset from login page' in your favourite search engine, that is all I did.
Essentially you are creating an override of the Login page through the template system to disable the links from being displayed in way that wont be affected by upgrades to Joomla.
The approach you have taken in editing the code supplied by Joomla would mean that even if it did work for you then it would get replaced the next time Joomla updates com_user. Joomla has a good collection of ways to override many things and it is something you should learn more about if you want to understand Joomla better.