Shiny user input interaction with .R file

I have a working script that I'd like to convert to a shiny app for users. To run, the script calls functions from a source file.
The issue I'm having I think with shiny is the user selects their inputs but the values aren't interacting with the script. Normally those variables are hardcoded in by me, but if the user is selecting values they should show up right?

I sourced the script after the user selects their input so that it would register the new values selected.

# source for script
source('source.R', local = TRUE)

ui <- fluidPage(
  titlePanel("Submarket Snapshot"),
                           label = 'Enter Quarter', 
                           min = "1900-01-01",
                           max = Sys.Date(),
                           format = "yyyy-mm-dd",
                           startview = "year"),
                             c('LA-Ventura','Orange County','Inland Empire'))),
server <- function(input, output, session) {
  output$marketview_ppt <- renderPlot({
    # script
    source('script.R', local = TRUE)
shinyApp(ui = ui, server = server)

The script connects to postgres and uses 'report_quarter' to grab information for that quarter. After it grabs all that information it filters by market 'report_market'. The variables are used all throughout both the script and source. Here's a snippet of the data being plotted based off quarter and market.

plot_vacancy_rate = function(historical_data,
                             markets = c("Inland Empire"),
                             past_n_years = 4){
  stats = historical_data %>% 
    filter(Market %in% report_markets,
           `Snapshot Date` <= report_quarter,
           `Snapshot Date` >= report_quarter - years(past_n_years)) %>% 
    group_by(`Snapshot Date`) %>% 
    summarise(vacancy_rate = sum(`Vacant SF - Total`, na.rm=T)/sum(NRA, na.rm=T))
  quarter_labels = stats %>% 
    distinct(`Snapshot Date`) %>% 
    mutate(quarter = quarter(`Snapshot Date`)) %>% 
    group_by(year = year(`Snapshot Date`)) %>% 
    mutate(qlabel = case_when(quarter == min(quarter) ~ str_c(year(`Snapshot Date`), " Q", quarter),
                              T ~ str_c("Q", quarter))) %>% 
    ungroup() %>% 
    select(-quarter, -year)
  stats %>% 
    ggplot(., aes(x = `Snapshot Date`, y = vacancy_rate))+
    geom_col(fill = cbre_pal[1])+
    geom_text(aes(y = vacancy_rate+max(vacancy_rate)/50, label = scales::percent(vacancy_rate, accuracy = .1)

in principle such a concept can work; though I would not typically attempt that; I would prefer a script defined reusable functions and the app would call those functions; but as I say, in principle you could build out an app in the way you describe.
You havent provided the contents of script.R so we can't know what goes on there.
We can see that your app shouldnt work because of the following
it makes a an output$trend but there is no plotOutput("trend") in your UI; possibly its marketview_ppt ?

@nirgrahamuk Why reusable functions and not reusable variables? If it's just the variable that's getting added through the input shouldn't that be the same?

'trend' was something I was testing out forgot to take it out. How would you recommend I go about this as I want to make it useable for others without having to be asked personally to run it?

So your script does define a function plot_vacancy_rate... that you dont call ?