Testing nonlocality in quantum networks using iteratively obtained Bell inequalities