In general you have to assign some probability distribution to your map or cells individually and update them iteratively.
In the very simple case you can just apply a low-pass filter to each of your cells. Like that: $p[t] = a*p[t-1] + (1-a)*I(occupied)$ where I is an indicator function which is set to 1 if current lidar measurement shows that cell is occupied and to 0 otherwise.
Better way is to look at SLAM methods like FastSLAM. Which use particles and kalmanKalman filters underneath. Comparing to the case I described above, Kalman filter will produce better estimates, because it is optimal in the sense that it minimisesminimizes variances thus giving you as presiceprecise estimate of a mean as possible.