WordPress has built in function to show next/previous post link. If you want to get Next and Previous post urls, then copy following code snippet. It does just what you want.
<?php $next_post_url = get_permalink( get_adjacent_post(false,'',false)->ID ); $previous_post_url = get_permalink( get_adjacent_post(false,'',true)->ID ); ?>
These variables just contains the link to previous and next post. Now you can place these links whereever you want.
[Ref: https://codex.wordpress.org/Function_Reference/get_adjacent_post]