Okay, so now we know IF you are on a VISA <- meaning a sticker from a thai consulate from another country, you put that number on it.
BUT
IF you are on an extension of stay <- a STAMP from the immigration office INSIDE the country & have a re-entry permit <- also a stamp from the immigration office inside the country; Put the re-entry permit number on the "visa number" spot of the TM.6..
Example:
In this example image the extension of stay number is
*****
********
<- that is NOT the number you put on the TM.6 card
the re-entry permit number is
*****
********
<- that IS the number you put on the TM.6 card