We need to go throught the gates one by one to understand what's happening.
We have to keep a few things in mind.
- $H|0\rangle=\frac{1}{\sqrt2}(|0\rangle + |1\rangle) = |+\rangle$ and $H|1\rangle=\frac{1}{\sqrt2}(|0\rangle - |1\rangle) = |-\rangle$.
- In the Hadamard basis the $Z$ gate acts like the $X$ gate. Namely $Z|+\rangle=|-\rangle$ and $Z|-\rangle=|+\rangle$.
- The controlled Z gate $cZ$ does the following here $cZ|0\rangle \otimes |\pm\rangle = |0\rangle \otimes |\pm\rangle$ and $cZ|1\rangle \otimes |\pm\rangle = |1\rangle \otimes |\mp\rangle$.
Now we start in the state $|0000\rangle$ and this gets converted to $|++++\rangle$ by the first column of Hadamard. Lets focus on the first 2 qubits. The $cZ$ gate takes the state
$|++\rangle = \frac{1}{\sqrt2}(|0\rangle + |1\rangle)|+\rangle$ and transforms it into
$$cZ\frac{1}{\sqrt2}(|0\rangle + |1\rangle)|+\rangle = \frac{1}{\sqrt2}(|0\rangle \otimes |+\rangle + |1\rangle \otimes |-\rangle) = \frac{1}{\sqrt2}(|+\rangle \otimes |0\rangle + |-\rangle \otimes |1\rangle)$$
The last expression can be derived using a expanding and rearranging of the terms.
We now move onto the 2nd $cZ$ gate which is applied on the 2nd and 3rd qubit. Remember the 3rd and 4th qubit both are still in $|+\rangle$ state. Application of the next $cZ$ state can be written as follows.
$$I \otimes cZ\frac{1}{\sqrt2}(|+\rangle \otimes |0\rangle + |-\rangle \otimes |1\rangle)|+\rangle \\
= \frac{1}{\sqrt2}(I|+\rangle \otimes cZ|0\rangle|+\rangle + I|-\rangle \otimes cZ|1\rangle|+\rangle) \\
= \frac{1}{\sqrt2}(|+\rangle|0\rangle|+\rangle + |-\rangle|1\rangle|-\rangle) \\
= \frac{1}{2}(|+\rangle|0\rangle|0\rangle + |+\rangle|0\rangle|1\rangle +
|-\rangle|1\rangle|0\rangle - |-\rangle|1\rangle|1\rangle) \\
= \frac{1}{2}\big((|+\rangle|0\rangle + |-\rangle|1\rangle) \otimes |0\rangle
+ (|+\rangle|0\rangle - |-\rangle|1\rangle) \otimes |1\rangle)\big)$$
We now apply the final $cZ$ gate on the 3rd and 4th qubits. Remember the 4th qubit is still in $|+\rangle$ state.
$$I \otimes I \otimes cZ \frac{1}{2}\big((|+\rangle|0\rangle + |-\rangle|1\rangle) \otimes |0\rangle + (|+\rangle|0\rangle - |-\rangle|1\rangle) \otimes |1\rangle)\big) \otimes |0\rangle \\
= \frac{1}{2}\big((|+\rangle|0\rangle + |-\rangle|1\rangle) \otimes cZ|0\rangle|+\rangle + (|+\rangle|0\rangle - |-\rangle|1\rangle) \otimes cZ|1\rangle|+\rangle)\big) \\
= \frac{1}{2}\big((|+\rangle|0\rangle + |-\rangle|1\rangle) \otimes |0\rangle|+\rangle + (|+\rangle|0\rangle - |-\rangle|1\rangle) \otimes |1\rangle|-\rangle)\big) \\
= \frac{1}{2}\big(|+\rangle|0\rangle|0\rangle|+\rangle + |-\rangle|1\rangle|0\rangle|+\rangle
+ |+\rangle|0\rangle|1\rangle|-\rangle - |-\rangle|1\rangle|1\rangle|-\rangle\big)$$
Now the final step is the application of the 2 $H$ gates on 1st and 4th qubit. From the final expression above, we can clearly see that only the 1st and 4th qubit are in Hadamard basis. Hence to convert them back to computational basis we apply $H$ again.
Finally after applying $H$ on these qubits we get
$$\frac{1}{2}H\otimes I \otimes I \otimes H\big(|+\rangle|0\rangle|0\rangle|+\rangle + |-\rangle|1\rangle|0\rangle|+\rangle
+ |+\rangle|0\rangle|1\rangle|-\rangle - |-\rangle|1\rangle|1\rangle|-\rangle\big) \\
= \frac{1}{2}\big(|0\rangle|0\rangle|0\rangle|0\rangle + |1\rangle|1\rangle|0\rangle|0\rangle
+ |0\rangle|0\rangle|1\rangle|1\rangle - |1\rangle|1\rangle|1\rangle|1\rangle\big) \\
= \frac{1}{2}\big(|0000\rangle + |1100\rangle + |0011\rangle - |1111\rangle\big)$$
This is the exact answer as you said the circuit would give. Hence I suppose the purpose of the $H$ is to convert the 1st and 4th qubits back into computational basis.
I hope this answer's your question.