Let $R$ be any ring , $X$ be any non-empty set & consider $M=R^{X}$ then M is a R-module with usual addition and scalar multiplication operations
Here $R^{X}=\{f\mid f:X \to R\}$
I need to use this statement to find a particular example taking $X$ to be a particular set (say) $X=\{1,2\}$, then how shall I definition a function for such a domain and codomain?
You define the functions formally (there are a lot of them, for example any constant function will do.) For example, take the special case $X=\{1\}$ and $R$ any ring. $\{f:X \to R\}$ is just a specification about where to send $1$, which is any element of the ring. In this case, $R$ acts on $f$ presumably by taking $f(1) \in R$ and $r\cdot f(1)$ in the usual sense, so this module is just $R$ over itself as a module.