Trying to implement BDS 4,4

The wind direction is just a vector difference:

wind vector = ground vector - airspeed vector

You can get the ground vector from ground speed + ground track; you can get the airspeed vector from TAS + heading. Headings are usually reported as magnetic headings, so you also need to correct for magnetic declination (this is essentially a lookup, there is lots of existing code to do this for you). The resulting wind vector is the movement of the air mass so you’ll need to reverse it to get the the usual sense for wind direction.

For temperature, start here: Speed of sound - Wikipedia

and look at the equations for Cair in terms of theta (air temperature). Cair = TAS / Mach number.