How a sugar acid crucial for life could have formed in interstellar clouds