I am making a composition that contains the sounds of traffic. How do I do this?
One way to get a car horn sound is to have two trumpets play an interval narrower than a major third, but wider than a minor third. For example, C and E half-flat.
This video may give you some inspiration for engine noises- they simulate the sounds with violin, cello, and trombone. Using a continuous pitch instrument is particularly helpful for emulating engine sounds.
Think about those sounds. They are normally considered noises, but that doesn't mean that normal instruments cannot reproduce them.
For horns, brass instruments are the obvious choice, maybe using some mutes. Also consider that some pieces that try to "picture" traffic sounds have already been written (see this section on the Wikipedia about "vehicle horn").
Engine sounds are a bit more tricky. If you need a "static" sound (an engine running at fixed speed) you will probably need to use a mixture of percussions that combine high pitched sounds to imitate the engine rotation and low pitched sounds for the "rumble".
Then, to imitate the passage of an engine car/truck you can try with glissando, possibly from a lower voice instrument; cello and trombone players often do it by joke.
My first suggestion would be that you look to (recent) history to see if anybody else has done the same thing or, failing an exact match, something similar. Then you can copy/modify what they did to suit your needs.
The nearest equivalent I can think of is Steve Reich's Different Trains. This has train sounds, sirens and bells along with human voices. According to the Wikipedia article he just pre-recorded these and then edited them in. That is, he recorded real trains, sirens, bells, etc.
If, as is likely, you don't find suitable examples already in the genre then pre-recording the real thing would be the sensible fallback position for which there is good precedent.