Have you defined the action
pressed is "left AND right", to be true, both need to be true, also is setted at the end of the code meaning it will be true if in the previous frame both actions were pressed.
Read line by line how the values change, follow the flow of the logic.
For the second one, you have never enabled input processing (
set_process_input) and you can use
is_action on events so there is no need for type and scancode checks if you have the option of actions try to use that instead of scancodes and things like that.
Also get used to debugging, the remote inspector will show a lot of details of the live tree and you can easily check if your nodes are correctly placed on the scene