I have to prove that $X \cap Y$ is closed.
My idea is to apply the definition of a closed set:
Consider a sequence $(x_n)$ of members of $X \cap Y$. If the sequence $x_n$ tends to some limit point $x$ in $\mathbb{R}$ as $n$ tends to infinity, then we need to show that $x$ is a member of the set $X \cap Y$. That will prove that $X \cap Y$ is closed.
This idea is correct? or, can we prove it with another method?
As has been pointed out in some comments, you have to say with which topology you want to work. Unfortunately your response to a comment is illegible to me.
The space of continuous functions is typically equipped with the topology arising from the sup norm, $$ ||f|| = \sup\{|f(x)|\, x \in [a,b]\} $$ (assuming you are looking at continuous functions on $[a,b]$). Since the space of continuos functions, with this norm, is a Banach space, the question whether a set is closed can be answered by looking at sequences, as you suggested.
In general, if your topology is derived from a metric, the same conclusion is valid, see, e.g., here: Closed set in normed vector space