You use an exclamation mark at the end of a sentence when you want to show surprise or strong emotion. Be careful not to use exclamation marks too often.
I'm late! I have to go.
In this example, there is an exclamation mark after 'I'm late'. This shows that you are surprised (and maybe worried) that you are late. You didn't expect to be late.
When you use a punctuation mark, you need to put a space after it. Don't use a space before the punctuation mark.