You are trying to use a numpy arrays attribute for a normal list.
When you write x_train = [] that creates an empty list and data is added to it with the loop. Then with x_train.shape[1] you treat it as numpy array. If you want the length of your list, or how many elements it contains, you can use len(x_train)
x_train is defined as an empty list []. As stated in the error, lists don't have any attribute called shape.
I'm assuming you're trying to use it as if it were a numpy array.
If you want a more in-depth tutorial on how to use it, see https://www.w3schools.com/python/numpy/numpy_array_shape.asp
Basically, the shape attribute exists on numpy arrays, not regular python arrays.
You can create numpy arrays with np.array - for example, np.array([1, 2, 3, 4, 5]).