Simple proof about prime filters.

Your left to right direction ($\Rightarrow$) is correct, but it would be good if you justify the existence of $F'$ a bit more. For example, there is an easy explicit description in terms of $F$ and $S$: $$ F' = \{A \subseteq X : S \cap B \subseteq A \text{ for some } B \in F\}. $$ We call $F'$ the filter generated by $F \cup \{S\}$.

The right to left direction ($\Leftarrow$) needs work. To show that $F$ is maximal you have to show $F = F'$ for any (proper) filter $F'$ with $F \subseteq F'$. As you have currently written it, $F'$ is of a specific form (namely with $S \in F'$). Even though you do not use this in what follows, the reasoning still breaks down. The problem is in the step where you claim that "$(X \setminus Z) \cup Z \in F$ implies $X \setminus Z \in F$ or $Z \in F$". This is true for prime filters, but that is exactly what you have to prove (being prime is equivalent to being an ultrafilter, as you noted as well).

It might be good to have an example why this step generally breaks down. We consider $X = \mathbb{N}$ and we let $F$ be the filter of cofinite sets. That is, $A \in F$ if and only if $\mathbb{N} \setminus A$ is finite. It should be easy to verify that this is a filter. Now let $E \subseteq \mathbb{N}$ be the set of even numbers, and $O \subseteq \mathbb{N}$ be the set of odd numbers. Clearly $E \cup O = \mathbb{N}$, so $E \cup O \in F$, but at the same time $E \not \in F$ and $O \not \in F$.

So how do we prove the right to left direction? We can take your approach of proving maximality. So let $F'$ be a proper filter with $F \subseteq F'$. Let $S \in F'$, we need to show that $S \in F$ because then we can conclude that $F = F'$ and so $F$ must be maximal because $F'$ was an arbitrary filter containing $F$. By our assumption on $F$ it is enough to show that $A \cap S \neq \emptyset$ for all $A \in F$, because then we get $S \in F$. Can you now finish the proof, using that $F \subseteq F'$ and that $F'$ is a filter?