There is no edit button on Mastodon (partly due to the potential for abuse), but there is something similar called redrafting.
If you have already posted something but want to change it, click on "..." and then "delete & re-draft". This deletes it, and puts a copy into the editing box so you can make changes and re-post.
WARNING: Using redrafting deletes the original message, so any links to the original will permanently break, and any replies will be orphaned.