If you have a single long strip of 24 individually controllable LED lights (such as
this), you are probably asking about a
KITT light, or a
Battlestar Glactica Cylon light, or (more generically) a
Larson scanner, who created the effect, you can do a search for the names and get plenty of solutions. Adafruit has a
nice project that explains it. Your LEDs might have different calls to address the bulbs, but the code concept is the same. This is what it sounds like you're trying to do.
If, instead, you have an
array of the LEDs, to make a sine wave, that's different.
If this is your first time working with LED strips, look for examples on how to use that particular type and try them out, making changes to the examples to see how the code operates.
Sometimes (most of the time) if your code "doesn't work" it is just missing one important bit, or your hardware isn't wired correctly. Code examples that work eliminates a lot of errors.