Short answer:
Yes, you can definitly do this
Long answer:
Depends.
If you have 2 Nodes, that should do exactly the same, but look different, then it's ok.
If they should behave different, then you should probably use inheritance.
Here is a nice tutorial: KidsCanCode-Tutorial
EDIT:
To make it more clear:
If you have to write 2 times the very same code, then you are doing something wrong.
If you want to change the behavior of something and have to replace it on 2 places in your code, then you should have made a function for that, or have inherited another script/node/whatever.
I hope you understand what i mean. If not, feel free to ask!