Hi @sharvina! A few more questions to try to narrow down what might be going on...
What happens if you try a script that uses only built-in data? For example:
tmp <- tempfile()
write.csv(mtcars, tmp)
more_cars <- read.csv(tmp)
lm(mpg ~ cyl + disp, data = more_cars)
How are you running the script? What happens if you use source() to run a saved script file from the console?