My requirement is signing the message with private key on one side and verifying it on other side using public key. SHA256, rsa:2048 are the algorithms i need to use. May i know whether X.509 is needed for my requirement if yes what is its role during signature generation and verification ?
So, I will interpret your question as:
what is the role of certificates during signature generation and verification?
There's no technology reason why you need a certificate. You sign something with your private key, someone else verifies it with your public key, done. The problem that certificates solve is getting your public key to the recipient without an attacker being able to put in their own public key instead.
Let's say you have a private key and the corresponding public key. You sign a message with the private key. You want somebody else to be able to verify your signature. Well they need your public key in order to do that. The question is: how do you get your public key to them without it getting intercepted and replaced by an attacker's public key? This is known as the key distribution problem. If you have a way to do that, like a GPG Public Key Server, or an internal corporate network share then you don't need certificates at all.
But if you need to send your public key over an insecure method, like email, then having a Certificate Authority make a certificate for your public key ensures that no attacker can do a man-in-the-middle and replace your public key with their own.