How to repair loose nails in a carpet threshold?
The easiest thing is likely to get a 1.5&quot; long piece of tie wire.  Put the tie wire piece into the hole and then hammer the nail back into the hole.  The tie wire metal will allow the nail to get a secure hold in the stripped out hole.
Your threshold is fastened to the subfloor.  Really the only constraint here is the aesthetics of the fastener head in threshold.  If you are not picky about the color or appearance of the fastener head then you can use whatever will work.
Generally carpet will be 1/2&quot; thick, your threshold is likely 1/4&quot; higher and your subfloor is going to be ~3/4&quot; so you want a 1.5&quot; long fastener.
You can certainly make the hole in the metal larger to accept a larger diameter fastener and you can certainly use a screw.