Your grep seems not precise, perhaps you mean grep -i '^x.*\.com$' (starts with an x then any amount of characters then .com at the end)
A sed 's/$/,/' does not delete $ because it is an anchor - not a character. But after an N command (that appends the following line to the input buffer) one can remove the embedded \n character.
The following works on all Unix-like OS:
The expression looks for an x followed by any number of characters followed by .com however this is not anchored to the beginning or end of a line. What is your input data like?
This input would still give some confusing results:-
..... and lots of other variations. It leaves me a few questions::-
What precise conditions do you want for the search in the first place?
What output do you want? The full email address or just the domain.
We are adjust the search to get just records you are after, but the search needs to be precise, e.g. does the line start with x or have x immediately after @ ; does .com have to end the line etc. All sorts of rules can be written if you can be sure what you want. If you could post a representative sample of your input and desired output (in CODE tags) then that will give us more to work with.