If all you’re attempting to do is add a separator between links you’d be better off just scrapping what you have and do this:
Create a new menu in the WP backend. Add your pages/links and save the menu.
Then just use <?php wp_nav_menu( array('menu' => 'Name of Menu Here' )); ?>
to display your menu. It will render an unordered list that you can then style using CSS
Use CSS to style the <li>
tags that are rendered. Give each one a left or right border to achieve your separators. That will also not include an unnecessary span tag around each on to just ad a pipe separator.