Why would 6 stops on a Shimano shifter travel 7 cogs with a Shimano derailleur?
Sounds like you bought the wrong shifter.  The &quot;ST-EF500&quot;  is available in both 7 speed and 8 speed
A 7 speed shifter has 7 resting positions, and will click 6 times across its range. ST-EF500-7R4A
Likewise, an 8 speed shifter will click 7 times.
ST-EF500-8R4A
If your cassette has 8 cogs total, then you need an 8 speed shifter.

If you're totally stuck with these parts, you could make them work somewhat by ignoring one outside cog.  The inter-gear spacing between 6/7/8 speed is the same, and the cassette gets wider as gear count increases.
Conversely, 8/9/10 speed cassettes are all the same width, but the inter-cog spacing decreases.
You could choose to disregard either the top or bottom gear, and index the other seven.  If you never spin out while riding, then exclude the smallest cog.  If you never ride up hills and need a low gear, then exclude the largest cog from indexing.
This is not an ideal solution - the correct shifter would be best.