I'm trying first to derive the exact sequences from the commutativity of the squares. In a exact sequence, the image of one function is the kernel of the other. However, where can I connect that $0$ on the left? In order for me to see $\ker f$ as the input to $\ker g\circ f$, shouldn't these 2 homomorphisms be connected?
Sorry if I'm too vague, but this book it's too heavy and there are only few definitions. In fact, this should be a theorem, but the book gives as an exercise.
For the part where it defines the homomorphism $h$, that is a coset, right? So I guess the isomorphism theorem for modules should be used, but it's too heavy for me.

To derive the first exact sequence, use that fact that $\ker f\subset \ker g\circ f$. If $x\in\ker f$ then $f(x)=0$ so $g(f(x))=0$ as well so $x\in\ker g\circ f$. So the mapping $\ker f\rightarrow \ker g\circ f$ is just the inclusion mapping.
To define $h$ note that $\textrm{coker} f=Y/\textrm{Im} f$. So yes, the elements of $\textrm{coker } f$ are cosets. Then you have to prove that $$0\rightarrow \ker f\rightarrow \ker g\circ f\rightarrow \ker g\stackrel{h}\rightarrow\textrm{coker } f\rightarrow\textrm{coker } g\circ f\rightarrow \textrm{coker } g\rightarrow 0$$ is an exact sequence.