How to properly represent a matrix function. Given the function $f_{h}(x,y,z)=(x-z,y+hz,x+y+3z)$, what is the correct way to represent the matrix function in respect to the standard basis? 
With the representation theorem, I would write the matrix in columns as:
$$F_{h|S_3}=(f_h(e_1)|{S_3} \quad f_h(e_2)|{S_3} \quad f_h(e_3)|{S_3})=\begin{bmatrix}1 & 0 & 1\\ 0 & 1 & 1\\ -1 & h & 3\end{bmatrix}$$
But in my textbook it is written in rows as:
$$F_{h|S_3}=(f_h(e_1)|{S_3} \quad f_h(e_2)|{S_3} \quad f_h(e_3)|{S_3})=\begin{bmatrix}1 & 0  & -1\\ 0 & 1 & h\\ 1 & 1 & 3\end{bmatrix}$$
What is the difference between them?

The correct way to represent the function $f_h$ in matrix form depends on the convention  that you want to use to represent it. Let $(x,y,z) \in \mathbb{R}^3$. The matrix which you computed is useful for expressing $f_h$ as  $$f_h(x,y,z) = \begin{bmatrix} x& y & z \end{bmatrix} \begin{bmatrix} 
1& 0 & 1 \\
0 & 1& 1\\
-1 & h & 3
\end{bmatrix}.$$ We can verify this by expanding the matrix product:
\begin{align}
\begin{bmatrix} x& y & z \end{bmatrix} \begin{bmatrix} 
1& 0 & 2 \\
0 & 1& 1\\
-1 & h & 3
\end{bmatrix} &= \begin{bmatrix} 
x \cdot 1 + y \cdot 0 + z \cdot (-1) \\
x \cdot 0 + y \cdot 1 + z \cdot h \\
x \cdot 1 + y \cdot 1 + z \cdot 3
\end{bmatrix} \\ &= \begin{bmatrix}
x - z & y + hz & x + y + 3z \end{bmatrix}.
\end{align} The result is a $1 \times 3$ matrix, which we can interpret as a row vector in $\mathbb{R}^3$. 
The matrix written in your textbook is useful for the following representation: 
$$f_h(x,y,z) =  \begin{bmatrix} 
1& 0 & -1 \\
0 & 1& h\\
1 & 1 & 3
\end{bmatrix} \begin{bmatrix}
x \\ y \\ z \end{bmatrix} = \begin{bmatrix} x-z \\ y + hz \\ x + y + 3z \end{bmatrix}.$$ The result is a $3 \times 1 $ matrix, which we can regard as a column vector in $\mathbb{R}^3$.
The two representations look different in the sense that the former yields a row vector and the latter a column vector, however they are the same in the sense that they can both be regarded as lists of three real numbers, i.e. as $(x-z,y+hz,x+y+3z) \in \mathbb{R}^3.$ The accepted answer here sums this idea up pretty well.
