How to add a new file in any directory by right-click add a new ...file (text, doc etc.) easily?

After looking for this I managed to do it by adding template files to Home/Templates directory. Firstly open an app, like text editor. (You can tap on start button and type text editor, it will pop up) Then click on save the file. (Ctrl+S or click on save) On the opening window, choose Templates directory and give the file a good name like "txt file". Click on save. You will see a button on right click on a folder named New Document. When you come on this New Document option, you will see the "txt file".

Adding file to the directory


To create 'new document' option in right click menu, do the following: Check if Templates directory exists:

ls ~/Templates

If it doesn't exist, create the directory:

mkdir ~/Templates

Now, to create templates of the desired new documents, it is sufficient to create them with the appropriate names in Templates directory. For instance, to create a template of empty document:

touch ~/Templates/'Empty Document'

Then you will find the option New Document/Empty Document in the right click menu in your file manager.

To create other document templates:

touch ~/Templates/'New Text Document.txt'

or

touch ~/Templates/New\ PNG\ Image.png

and so on...

Reference: https://ostechnix.com/how-to-add-new-document-option-in-right-click-context-menu-in-ubuntu-18-04/