(Just an action is indicated.) Past perfect: I had written the letter before she advised me against doing so. (Two actions: writing and advising.) The examples show that some people confuse has ...
When we tell a story in the past, we often use linking words or phrases to join two or more sentences or clauses. This helps the narrative to flow in a more interesting and natural way.