When viewing a schematic, explore the Hierarchy menus.
You can design a "leaf" schematic, put IO ports on it, let LTSpice automatically build a symbol with pins on it. The pin names on the instance match the port names. The symbol will have the same name at the schematic but will have a .asy extention in place of the .asc.
To instantiate the newly-created symbol in a higher-level schematic, click on the NAND gate icon. In the top dialog box, point to the subdirectory where the newly created symbol got put in lieu of ../lib/sym, and then you can place (even multiple) instance(s) of the new symbol.