##Canvas, 14 14 12 bytes
H;[:::2*×∔;3*+H;[⌐⌐∔*×∔;3*+
Code |Instruction |Stack
----------+---------------------------------------------------------------------+-------------------------
|Push input to stack (implicit) |I
H |Push "H" to stack |I,"H"
; |Swap the top two stack items |"H",I
[ |The following ToS (input) times: |X
:::|Duplicate⌐⌐ |Duplicate ToS (result from last loop ("H" if first loop)) threefour times|X,X,X,X,X
2*∔ |Repeat twice|Join vertically |X,X,X,X\nX
× |Prepend |X,X,XX\nX
∔ |Join vertically |X,X\nXX\nX
; |Swap top two stack items |X\nXX\nX,X
3* |Repeat3*|Repeat three times vertically |X\nXX\nX,X\nX\nX
+ |Join horizontally |X<space>X\nXXX\nX<space>X
|End loop (implicit) |X
|Print ToS (implicit) |
Where I
is the input, X
is the pattern generated by the previous loop ("H" for the first loop), and <space>
is the empty space on the first and third row of the pattern, added implicitly by +
.
-2 bytes thanks to dzaima!