trouble creating a negative log likelihood for a linear model in R I am new to stats and R and I am having trouble figuring out how to calculate a function that gives me the NLL of a linear regression. 
 A: Preliminary Note: In your plot you place the dose on the horizontal axis and survival on the vertical axis, yet your stated model uses survival as the predictor and dose as the response (with the result that the line on the plot is not the line-of-best-fit).  I am going to assume this is a mistake, and use survival as the response.

For a linear regression model (with normally distributed errors), the negative log-likelihood (NLL) is:
$$NLL(\boldsymbol{\beta},\sigma) = -\ell_{\mathbf{y},\mathbf{x}}(\boldsymbol{\beta},\sigma) 
= \frac{n}{2} \cdot \ln(2 \pi) + n \cdot \ln(\sigma) + \frac{1}{2 \sigma^2} || \mathbf{y} - \mathbf{x} \boldsymbol{\beta} ||^2.$$
When you fit a linear model using th lm function in R this uses ordinary least-squares (OLS) estimation, which minimises the log-likelihood function (or equivalently, maximises the negative log-likelihood function).  Thus, at the estimated parameters values in the fitted model you have:
$$\max_{\boldsymbol{\beta},\sigma} NLL(\boldsymbol{\beta},\sigma) = -\ell_{\mathbf{y},\mathbf{x}}(\hat{\boldsymbol{\beta}},\hat{\sigma}) 
= \frac{n}{2} \cdot \ln(2 \pi) + n \cdot \ln(\hat{\sigma}) + \frac{1}{2 \sigma^2} \cdot \text{SSE}.$$
We can calculate this maximised value of the NLL using the output from the linear model using the following R code:
#Define the data-frame and fit the linear model
DATA   <- data.frame(dose = dose, survival = survival);
MODEL  <- lm(survival ~ dose, data = DATA);

#Calculate the maximised NLL
n      <- nrow(DATA);
SSE    <- sum(MODEL$residuals^2);
sigma  <- summary(MODEL)$sigma;
MAXNLL <- (n/2)*log(2*pi) + n*log(sigma) + (1/2)*(1/sigma^2)*SSE;

MAXNLL
[1] 25.68076

