Here’s a revised version of your text with grammatical errors corrected and repetitive phrasing reduced:
The Ceratosaurus lived about 145 to 161.2 million years ago during the late Jurassic period. It inhabited North America, often in proximity to Allosaurus and Torvosaurus. Fossils of Ceratosaurus have been found near water, indicating that it likely lived close to bodies of water. Given its crocodile-like tail, the Ceratosaurus may have been able to swim, which would have aided in catching food.