To run commands on the remote machine, you have to give commands in input to ssh. For simple commands you can use the syntax
ssh user@hostname <command>
where command is a string (better enclose in double quotes) containing the command you want to execute. Or you can use a "here document", e.g.
ssh user@hostname << LimitString
where the commands placed after the ssh line and before the "LimitString" are executed on the remote machine. Actually you can use any string in place of "LimitString". You may also consider "private/public key authentication" to avoid typing password.