nodegen works with latest Node-RED. When you say you are adding code to .js file directly - that is not the way it is supposed to work. As previously point out - you create a function node in Node-RED then save it to the library (book icon on the node config page) - then point nodegen at that file in the library.
the two methods of creating nodes cannot be mixed. (At least not easily).
You do not export the whole node. You do not hand-create a .js file, unless you also add the extra meta-data lines that are shown in the post I link to.
I do think that nodegen could be updated to work with the JSON export of a Function node, because it will contain all of the required information. But that is a separate discussion.
Everything worked .
Thank you so much . .
It will be helpful if we have a documentation with sample code and UI screen shots .
I was using Node-red for many years ,but did not realize that there is a book icon to save to .js .
My next step is to add an a require statement and use code from another library .