Suppose $G$ is a finite group, $(G:1)=n$. $f_g: G \to G$ is a function such that $f_g(x) = gx$. It can be easily noticed that $f_g$ maps $G$ over $G$ one-to-one. Suppose $G={a_1,...,a_n}$. Then we can define a permutation $\pi$, such that $\pi(a_k)=ga_k$. Let $a_{i_k}=ga_k$. We'll assign this permutation as $\pi(f_g)$. Now suppose we have $f_g$ and $f_h$. Then the book says that $\pi(f_{gh}) = \pi(f_g)\pi(f_h)$. $\pi(f_g)(a_k) = a_{i_k}$. But $\pi(f_h)(a_{i_k})=ha_{i_k} = hg_{i_k}$. So I'm getting that the product of those two permutations is actually equal to $\pi(f_{hg})$, but $gh \neq hg$ in the general case. This is part of the proof of a theorem in the book so I find it unlikely that there is a mistake in the book. But if it's so, then what am I missing?
P.S. the theorem states that there is an isomorphism between G and some subgroup of $S_n$, and it shows that $\phi: G \to \{\pi(f_g)| \forall g \in G\}$, such that $\phi(y)=\pi(f_y)$ is an isomorphism. So it is necessarry to prove that the set of $\pi(f_g)$ permutations is a group and it's what the book is doing.