To make a 404 page, you need some form of access to a server, the server would respond to a request in which the contents cannot be found with a 404 error and optionally some content to visually display the error.
Since this has to be done on the server-side, you will need a server-side language to receive a request, determine it cannot find the content that the request is looking for and so send a 404 status and some content. Some good examples of server-side languages that are very popular and would enable you to do this are NodeJS and Python.
Alternatively, like @hugoondev has said, you could use a .htaccess file (however this is currently not available on Replit). From what I understand of the .htaccess file, it acts technically like a server-side language would and enables you to do what you want, but nothing more.
This is a difficult problem on replit, due to the limitations for handling such errors. If you have SEO and have a specific link that you want to display (e.g. an outdated one) a 404 on, add this to that page: