And the question is ...? You may want to refer to your shell's man page for an explanation of that special parameter.
Please become accustomed to provide decent context info of your problem.
It is always helpful to carefully and detailedly phrase a request, and to support it with system info like OS and shell, related environment (variables, options), preferred tools, adequate (representative) sample input and desired output data and the logics connecting the two, and, if existent, system (error) messages verbatim, to avoid ambiguities and keep people from guessing.
I'm afraid that with /bin/sh you're out of luck: It doesn't offer the $_ special parameter (according to its man page) nor the history command that e.g. bash provides.
Another technique:
Store the command first, put it into 'ticks'. A tick within ticks is escaped '\'' .
When running the command "eval" lets pipes semicolons etc. work.