How to create my own material node?

Did you look into MaterialFunctions? You can create 1 for your second problem where you have several inputs and outputs.

Unreal’s material editor does not support structs so you’d have to seperate all the variables.