交通に注意しなければいけない。

English Translation

You must look out for traffic.

No, we never say 交通に注意する. It’s a bad collocation. 交通 is closer to “transportation”. I would propose:

車(くるま)に注意しなければいけない。

交通安全を心掛けなさい。(こうつうあんぜん を こころがけ なさい。)

The first sentence with 車 is not limited to cars, but includes all vehicles.

交通安全 in the second sentence is a common set phrase, meaning “road safety”. 心掛ける literally means “to hook your heart on something”, and thereby means “make an effort to keep a good conduct”. 交通安全を心掛ける includes not only “to be careful when a car/bike is passing by you” but also “to carefully drive a car/bike not to harm other passengers”.