Time series model sample ACF in R I have to simulate a sample of size $n=1000$ for the model $X_t=0.9 X_{t-1}+ Z_t$ with $(Z_t)$ iid student t-distributed with 10 degrees of freedom.
I have to plot the sample ACF for the first 20 lags with the program acf in R.
I'm not the best to R but I thought that I have made a plot:
set.seed(123)

# Simulate 250 observations from the described MA(1) model
ma1_sim <- arima.sim(model = list(ma = 0.9), n = 1000, mean = 0, 
    sd = 0.1)

# Generate the theoretical ACF with upto lag 20
acf_ma1_model <- 
  
# Split plotting window in three rows
par(mfrow = c(3, 1))

# First plot: The simulated observations
plot(ma1_sim, type = "l", main = "MA(1) Process: theta = 0.9", 
    xlab = "time", ylab = "y(t)")
abline(h = 0)

# Second plot: Theoretical ACF
plot(1:20, acf_ma1_model[2:21], type = "h", col = "blue",  
    ylab = "ACF", main = "theoretical ACF")

# Third plot: Sample ACF

tmp <- 

  par(mfrow = c(1, 1))

Then I get the plot:

But I'm not sure that this is correct and I can't see anywhere in my problem the value for sd so I have just set it to 0.1. Can anyone help me with the problem and maybe correct some of my code?

You're describing an AR (autoregressive) model, not an MA (moving average) model.
Find below some simpler code that does what you need, I think. You didn't specify what your time series $X$ looks like so here I'm arbitrarily assuming $X\sim N(100,10)$ - but feel free to change this.
# set random seed
set.seed(123)
# 1000 observations
n <- 1000
# simulate the time series (X)
x <- rnorm(n, 100, 10)
# create X_{t-1} - note that the length of this series will be 999...
# ...because I'm removing the first NA term
x_1 <- lag(x)[2:length(lag(x))]
# simulate the data coming from the AR(1) model with errors distributed t(10)
ar1 <- 0.9*x_1 + rt(n-1, 10)
# plot the ACF for the first 20 lags
acf(ar1, lag.max = 20)


