"In the end" is used mostly as an idiom that means "finally," "after a long time," or, "when everything is considered." It is often followed by a comma.
We worked hard, and in the end, we achieved our goal.
"At the end" is most commonly used more literally, as a prepositional phrase followed by of, to refer to the end of a specific noun. This noun can be a physical object, a period of time, an event, a place, or something more abstract, such as one's patience.
At the end of his life, he had no regrets.
Put a period at the end of every sentence.