To record a demo press the tilde "~" key to go into console. Then type "record NAME" without the "Quotes" to start recording the demo. To stop the demo go back into console and type "stop".
Locating the demo
Counter Strike Source
* To locate the demo you recorded you'll need to go into the cstrike folder of counter-strike:source. Go to "C:\Program Files\Steam\steamapps\Login Name\counter-strike source\cstrike"
Team Fortress 2
* To locate the demo you recorded you'll need to go into the
tf folder of team fortress 2. Go to "C:\Program Files\Steam\steamapps\Login Name\team fortress 2\
tf"
To watch the demo see
How do i watch a demo in tf2 or cs:s.
To enable console see
[CS:Source] [TF2] Enable Console