In The End versus At The End.
In the end
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. Here are some sentences with this idiom:
We worked hard, and in the end, we achieved our goal.
In the end, what really matters in a friendship is trust.
At the end
At the end is used in the idiom “at the end of the day.” which means something similar to in the end (= when everything is considered). However, 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.
Here are some sentences with in the end + of:
At the end of his life, he had no regrets.
Put a period at the end of every sentence.
I pay the phone bill at the end of each month.
There is a brick building at the end of the driveway.