Group hourly NetCDF data (720 hours as indivisual band) into 24 hours (a day). Outcome with new .NC file with 30bands.

I would like to group hourly NetCDF data (720 hours as an individual band) into 24 hours (a day). The outcome with a new NC file with 30 bands (presenting 30 days).
I am using ncdf4 package

trying this code but not working. Any help would be appreciated.

april = nc_open("data.nc", write=TRUE, readunlim=TRUE)
print(april)
april_in = ncvar_get(april, "time")
april_in_day = ncvar_put(1:24, ,)
for (i in 1:720) {
april_in_day = ncvar_put((i*24):((i+1)*24), , )
}