Add Custom Field to a template page backend

You need to create metabox (contains custom fields with a form) for your post/page or custom post type. When you use your code block above, you only call for meta values of post. But if WordPress can’t find any custom field or meta value, these variables retun null (and you can not see any value)

You can try Advanced Custom Fields or CMB2 plugins to create custom fields and metabox for your posts/pages/custom post types easily (Also these plugins are well documented for begginers).

After create your custom fields and meta box, you can call values from frontend.

You can ask me anything about these plugins.