Thingy at the end of transmission mainshaft
Yes, Oohef is correct, it's a welch plug to stop oil running out the shaft & directing through the lubrication holes. Select a socket that slips inside the shaft. Remove plug, (your picture shows it going the correct way) & tap another socket into the plug while it's out of the shaft to swell its diameter slightly. Refit the plug using the selected socket (the one that slips inside the shaft) to tap plug in, keeping it to just below the bevel inside the shaft, approx 2mm. The shaft looks extremely worn & I'd be checking the bearing surfaces.