What is the origin of "uh", "um", "erm" and "er"?

Mostly they're not recorded.

They're called Hesitation Markers, or various equivalent names. They are the various sounds people make when they're hesitating to think of what to say next, or to remember a word, or just because they've drawn a blank. Emitting one of these markers signals an intention to hold the floor, and to try to keep one's conversation partners from taking the floor and interrupting one. These markers vary, from group to group, and language to language.

They're phenomena of Speech, though, not of writing. So, unless you're transcribing dialog, you shouldn't have to worry about how they're spelled. Which is good, because they're spelled any which way at all.

However, any spelling with an "R" in it comes from a non-rhotic dialect of English, like RP in the UK. And "UH" is a lame attempt to represent shwa - /ə/ - the commonest vowel in English, and the commonest hesitation marker. E.g,

  • He said .. /ə/ .. he said he wasn't .. /ə/ .. going to arrive on time.

How you spell it is up to you. The Academy hasn't ruled on that yet.