Reduce repetition in Pandas DataFrame column assignments
Try to get a good book or tutorial about pandas. The things you want to do is relatively easy with groupby.agg

for segment, segment_data in df.groupby("day_segment"):
    aggregated_data = segment_data.resample("D").agg(
        ["sum", "mean", "std", "min", "max"]
    )
    aggregated_data_renamed = aggregated_data.copy()
    aggregated_data_renamed.columns = aggregated_data.columns.droplevel(0).map(
        lambda x: f"step_{segment}_{x}allsteps"
    )

    filename = f"data{segment}.csv"
    aggregated_data_renamed.to_csv(filename, index=True)


This uses mean instead of avg. If this is a problem, you can add another rename function call somewhere