Put this formula in D1:
=A1
and this one in D2:
=IF(OR(ISNUMBER(SEARCH("beginning",A2)),ISNUMBER(SEARCH("end",A2))),A2,IF(COUNTIF(A$1:A1,"*beginning")=COUNTIF(A$1:A1,"*end"),A2,A2&" between"))
Copy the formula from D2 down as far as you need to.
Hope this helps.
Pete
Bookmarks