How can i safely clean up my phone for selling I am getting rid of my Samsung S 8 and need to reset to factory settingsHowever in the list of personal it tells me i am signed in to  yahoo  amongst others .Are my emails safe if Yahoo and others when i hit reset
If you mean to ask: "Are [your] emails safe if Yahoo and others [are deleted] when [you] hit reset?"

Then the answer to your question is yes, absolutely. Your phone simply acts as a medium between the email app (Gmail, Yahoo, Outlook, etc.) and where your emails are actually stored (in the respective apps' servers).

Using your example: Your Yahoo account, and all of the emails for it, are all part of Yahoo's servers. Deleting your Yahoo account off of your phone will make no difference to the account or emails still contained in Yahoo's servers. You would have to use a Desktop browser and log in to your Yahoo account, then find the option to delete your account, and explicitly click that option - if you were trying to delete your account. 

So yes, you have nothing to fear by factory resetting your phone in terms of keeping your account and emails safe.