Displays a link to edit the current post, if a user is logged in and allowed to edit the post. Can be used within The Loop or outside of it. If outside the loop, you'll need to pass the post ID. Can be used with pages, posts, attachments, and revisions.
Use get_edit_post_link to retrieve the url.
<?php edit_post_link( $link, $before, $after, $id ); ?>
Displays edit post link using defaults.
<?php edit_post_link(); ?>
Displays edit post link, with link text "edit", in a paragraph (<p>) tag.
<?php edit_post_link('edit', '<p>', '</p>'); ?>
edit_post_link() is located in