What is the error? if the last line is only move_and_slide() then I presume you have not extended a physics-based class like CharacterBody2D, what does the first line of your script say, what are you trying to program?
Also a much better way to do this input is uing Input.get_vector, results in normalized inputs in just one line.
var input_vector := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")