Question about the proof of "If $H$ is a Sylow $p$-subgroup of $G$, then $|H|=p^n$. Definition. A subgroup $P$ of a group $G$ is said to be a Sylow $p$-subgroup ($p$ prime) if $P$ is a maximal $p$-subgroup of $G$. 
Theorem. Let $|G|=p^{n}m$ with $p$ prime, $n\ge 1$ and $\gcd(p, m)=1$. Let $H$ be a $p$-subgroup of $G$. Then $H$ is a Sylow $p$-subgroup of $G$ iff $|H|=p^{n}$.
I have a problem in the 'if' part of the proof, which goes as follows:
Proof. ($\implies$)  Let $H$ be a Sylow $p$-subgroup and $|H|=p^{i}$, where $1\le i < n$. Then (by Sylow's first theorem$^1$) there exists $H'\le G$ such that $|H'|=p^{i+1}$ and $H \trianglelefteq H'$. Because $H$ is a maximal $p$-subgroup of $G$, it must be that $H=H'$, which is clearly not possible since $|H|\neq |H'|$. We thus have a contradiction and so $|H|=p^{n}$.
Question. Why does maximality imply that $H=H'$, and not $H'=G$? 

$^1$Theorem   Let $G$ be a group of order $p^{n}m$, with $n\ge 1$, $p$ prime, and $\gcd(p, m)=1$. Then,
(1) $G$ contains a subgroup of order $p^{i}$ for each $1\le i\le n$, and
(2) if $H\le G$ is such that $|H|=p^{i}$, where $1\le i < n$, then there exists some $H'\le G$ such that $|H'|=p^{i+1}$ and $H \trianglelefteq H'$. 
 A: If $H$ is a Sylow $p$-subgroup according to your Definition (maximality), then $|H|=p^n$ because such a maximal (in the hypothesis of your Theorem) $p$-subgroup does exist by Sylow's First Theorem.
A: Since $H'$ is a $p$-group, we can only have $H'=G$ if $G$ is a $p$-group. If $G$ has order that is not a prime-power, then clearly since $H'$ has prime-power order it cannot be equal to $G$.
Here, in contrast to the definition of a "maximal subgroup" which requires that the subgroup be proper, a maximal $p$-subgroup need not be a proper subgroup, so if $G$ is a $p$-group then $G$ is the maximal $p$-subgroup we speak of.
A: What is "maximal" ? In general, let $(U,\le)$ be a partially ordered set. An element $m\in U$ is called maximal if $x\le m$ for all $x\in \{u\in U \mid u\le m \text{ or } m\le u\}$.
In OP, $U=\{H\in 2^G \mid H \text{ is a $p$-subgroup of } G\}$ and for $H,H'\in U$, $H\le H'$ is defined to be $H \subseteq H'$. On one hand, $H'\subseteq H$ since $H$ is maximal. On the other hand, $H\subseteq H'$ according to Theorem 1. As a result, we have $H=H'$.
Remark that $G\notin U$ because $G$ is not a $p$-subgroup of itself if $m>1$. For $m=1$, $|H|=p^n$ implies that $H=G$.
