this line mean login to server and find the line with "mat water" and give that line equal to command_output_1, Am I right?
then read the what?
textscan() is always going to return a cell array.
With textscan() not having been passed any Delimiter or Whitespace options, and with one line at a time of the response being passed to textscan(), the effect will be that each Y1(m,1) entry will become a cell array of character vectors each of which is one "word" of the output of the line, where "word" is whitespace delimited. There are ways a lot more efficient than textscan() to achieve the same result.
This loop str2num is to change str to number, but I don't understand after str2num what is it do?
Notice the o=75 line. The o=o+1 line of code after the str2num() has the effect of moving on to column 76, 77, and so on, with o ending up as 109, after column 108 was converted. There are a lot more efficient ways of doing this too.
3) What are these line do? Is it run serpent ?
Not exactly. Those lines are preparing a shell command line for later execution, without executing it inside of what you posted so far. The shell command, when executed, would change directories, then create a file of qsub commands, and then invoke qsub to execute the commands, and then cd somewhere else. The shell command being created is to be executed by a Linux shell, it appears to me.