I made an inverter in LTSPICE and it is not working
This is your subcircuit, as you have built it (omitting the supplies):

Are you sure this is what you want? I suggest building the schematic in the GUI mode, then using View &gt; SPICE Netlist from the menu to copy the netlist.