the freestyle program should contain those lessons that are required in the corresponding test levels. - Some exceptions is rein back and stops because those are not required as they would interrupt the artistic flow, even though they are not forbidden.
There are some docs in the FEI rule book about which lessons fit to what level. Just make sure you don't forget one of the mandatory lessons.
Professionals will start composing a freestyle by combining the horses and riders strenghts in an optimal way and after that have the music designed to is. However that is a comparatively expensive way of doing it.
For an easier start you may do it the other way round. There are music CD's with freestyle music. Some of them with comments from Isabell Werth, Anky van Grunsven and many others. Buy one of those and try to fill the music with lessons from the appropriate paces.
After a while you will find that you can put the various lessons together within the music time frame. By riding those a few times you will find some transitions more difficult than others. Try to make it as easy going for you as possible and try to match the music time slots.
The result of this will be your first shot at freestyle. Tape it and watch it. You will get ideas about improvements yourself.
well, and you may ask some pro's for comments. An inexpensive way to get advice is to ask one of the judges at a competition. They see many of those and most of them will happily give some advice - even free of charge- at the event. After looking at the videotape of that performance you will see where to make the next steps.