If you want the data to persist for a session (not through actually refreshing the page) you can use st.session_state to keep track of the names
import streamlit as st
if "names" not in st.session_state:
st.session_state["names"] = []
name = st.text_input("What is your name ?", placeholder="")
surname = st.text_input("What is your surname ?", placeholder="")
f5_button = st.button("Refresh")
if f5_button:
st.session_state["names"].append(f"{name} {surname}")
st.markdown(st.session_state["names"])
However, if you really want it to persist data even if you actually refresh the page, you probably want to store the data either in cookies (through a component like this Cookies support in Streamlit!) of in an external database of some sort (Connect to data sources - Streamlit Docs).
Hope that’s helpful.