Attaching a topological space to another I'm self-studying Mendelson's Introduction to Topology. There is an example in the identification topology section that I cannot understand:

Let $X$ and $Y$ be topological spaces and let $A$ be a non-empty closed subset of $X$. Assume that $X$ and $Y$ are disjoint and that a continuous function $f : A \to Y$ is given. Form the set $(X - A) \cup Y$ and define a function $\varphi: X \cup Y \to (X - A) \cup Y$ by $\varphi(x) = f(x)$ for $x \in A$, $\varphi(x) = x$ for $x \in X - A$, and $\varphi(y) = y$ for $y \in Y$. Give $X \cup Y$ the topology in which a set is open (or closed) if and only if its intersections with $X$ and $Y$ are both open (or closed). $\varphi$ is onto. Let $X \cup_f Y$ be the set $(X - A) \cup Y$ with the identification topology defined by $\varphi$.
Let $I^2$ be the unit square in $\mathbb{R}^2$ and let $A$ be the union of its two vertical edges. Let $Y = [0, 1]$ be the unit interval. Define $f : I^2 \to Y$ by $f(x, y) = y$. Then $I^2 \cup_f Y$ is a cylinder formed by identifying the two vertical edges of $I^2$.

I don't understand how $I^2 \cup_f Y$ can be a cylinder. The set is equal to $(I^2 - A) \cup Y$. Which is a union of a subset of $\mathbb{R}^2$ and $[0, 1]$. How can this be a cylinder?
The book has an exercise that constructs a torus in a similar manner. I'm hoping to be able to solve it once I understand this example.
I looked up some examples online. While I understand the definitions and theorems of identification topologies, I have no clue how geometric objects are constructed.

I think it's good that you ask this question, plus one. Your intuition will eventually develop, don't worry.  I had trouble understanding identification topologies too when I saw them first. It just takes some time to get used to, don't worry. The way I think about it now, is as follows: 
You have two spaces $X,Y$ and you know how you want to "glue" them together, namely, you take all the points in $A \subset X$ and stick them on $Y$. The map $f$ tells you where on $Y$ you stick them. In pictures it looks something like this:

In the example, this looks like this:

