Nanomolding of topological nanowires