Insert data to transaction with OP_RETURN This might be a possible duplicate with this.

I want to know a proper way to insert additional string with OP_RETURN and retrieve the transaction from block chain and decode it accordingly.

Thank you
How do I add metadata to the blockchain?
Essentially, one of the output scripts should be
OP_RETURN &lt;the data you want to add&gt;

That's it.
Let me give an example. Say you want to add the string &quot;Melons.&quot; to the blockchain.

Convert to binary
&quot;Melons.&quot; -&gt; 4d656c6f6e732e
Add the push-data-onto-stack command at the start. This is the length of your metadata if it's less than 75 bytes, or OP_PUSHDATAx otherwise.
074d656c6f6e732e
Add OP_RETURN at the start
6a074d656c6f6e732e
Put this in the scriptPubKey of an output of a transaction. I wrote a guide on this here.

How do I find it again?
That's... trickier. Bitcoin is not optimized for searching the metadata of transactions.
Possibilities:

Look through all of the transactions you get with something like bitcointools.
Use a website like coinsecrets.org.