Convert plaintext script into hex-encoded script in python
I'm reading the specification. Your hex string has to start with 6a [OP_RETURN opcode] followed by 4c [OP_PUSHDATA1] followed by a one-byte number indicating the size (in bytes) of the following data. You have 10 bytes, so this 0a. Then come your actual data, and here I think you made a mistake. In any case, 0102030405060708090a (in your by-hand example) is neither the hex encoding of the string "12345678910" nor of the integer 12345678910. Look at this python snippets:

&gt;&gt;&gt; from binascii import hexlify
&gt;&gt;&gt; hex(12345678910)
'0x2dfdc1c3e'

&gt;&gt;&gt; hexlify("12345678910".encode()).decode()
'3132333435363738393130'


So I guess you need to clarify what your data represent and how you want it encoded...