Back and forth nudging algorithm for data assimilation problems