$$\langle x| M|x'\rangle=M(x)\langle x|x'\rangle=M(x)\,\delta(x-x')$$
I know this is true for if $M$ is a momentum operator or position operator, is this is true for a general operator $M $?
$\langle x'|M|\psi\rangle=\langle x'|\alpha\rangle=\alpha(x')$
this is equivalent to
$$\int \langle x'|M|x\rangle\langle x|\psi\rangle\,dx.$$
If equation 1 is true we can write this as
$$\int \langle x'|M|x\rangle\langle x|\psi\rangle\,dx=\int M(x)\,\delta(x-x')\,\psi(x)\,dx=M(x')\,\psi(x')=\alpha(x')$$
Equation one is not true implies equation 2 is also not true, but actually equation 2 is true in fact this implies equation one is also true.
Hear by $M(x')$ I mean operator operates on position representation of wave function; please clarify me where I am wrong, please help me to clear my concept.
Yes, $$\langle\ x\rvert \hat M\lvert\ x'\rangle=M(x)\langle\ x\lvert\ x'\rangle=M(x)\delta(x-x'),$$ provided you understand what you claim you do, namely $$\langle\ x\rvert \hat p\lvert\ x'\rangle=-i\hbar \partial_x \langle\ x\lvert\ x'\rangle=-i\hbar \partial_x\delta(x-x'),$$ so then that M(x) represents an operator consisting of functions of x and derivatives w.r.t. x in a specific associative order.
Proceed to verify that, for instance, indeed, $$\langle\ x\rvert f(\hat p) g(\hat x) h(\hat p) k(\hat x) \lvert\ x'\rangle \\ = k( x) h(-i\hbar \partial_x) g(x) f(-i\hbar \partial_x) \langle\ x\lvert\ x'\rangle \\ = k( x) h(-i\hbar \partial_x) g(x) f(-i\hbar \partial_x) \delta(x-x')~.$$